dcos-core-monalisav2-latam 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/README.md +130 -0
  2. package/index.js +350 -0
  3. package/package.json +52 -0
  4. package/src/auth/handler.js +3 -0
  5. package/src/common/MondelezCastOrder.js +449 -0
  6. package/src/common/utils/AuthSecurity.js +46 -0
  7. package/src/common/utils/account-error-handler.js +279 -0
  8. package/src/common/utils/account-error-helper.js +231 -0
  9. package/src/common/utils/account-properties-handler.js +355 -0
  10. package/src/common/utils/api-response.js +62 -0
  11. package/src/common/utils/aws-services.js +186 -0
  12. package/src/common/utils/constants/account-error-codes.json +801 -0
  13. package/src/common/utils/constants.js +37 -0
  14. package/src/common/utils/convert/MondelezClientsItemsCast.js +52 -0
  15. package/src/common/utils/convert/MondelezInventoryItemsCast.js +15 -0
  16. package/src/common/utils/convert/MondelezOrderStatusCast.js +34 -0
  17. package/src/common/utils/convert/MondelezPricesItemsCast.js +37 -0
  18. package/src/common/utils/cron-ftp-get.js +143 -0
  19. package/src/common/utils/data-tables-helper.js +213 -0
  20. package/src/common/utils/date-range-calculator.js +113 -0
  21. package/src/common/utils/delay.js +17 -0
  22. package/src/common/utils/ftp-sftp.js +320 -0
  23. package/src/common/utils/logger.js +126 -0
  24. package/src/common/utils/nodemailerLib.js +61 -0
  25. package/src/common/utils/product-unit-converter.js +168 -0
  26. package/src/common/utils/schemas-utils.js +101 -0
  27. package/src/common/utils/seller-email-sharing-service.js +441 -0
  28. package/src/common/utils/sftp-utils.js +202 -0
  29. package/src/common/utils/status.js +15 -0
  30. package/src/common/utils/util.js +236 -0
  31. package/src/common/utils/validate-state-order.js +35 -0
  32. package/src/common/utils/validateProviders.js +67 -0
  33. package/src/common/utils/validation-data.js +45 -0
  34. package/src/common/utils/vtex/save-hooks.js +65 -0
  35. package/src/common/utils/vtex/save-schemas.js +65 -0
  36. package/src/common/utils/vtex-hook-handler.js +71 -0
  37. package/src/common/validation/AccountCoordinatesValidation.js +350 -0
  38. package/src/common/validation/GeneralErrorValidation.js +11 -0
  39. package/src/common/validation/MainErrorValidation.js +8 -0
  40. package/src/entities/account.js +639 -0
  41. package/src/entities/clients.js +104 -0
  42. package/src/entities/controlprice.js +196 -0
  43. package/src/entities/controlstock.js +206 -0
  44. package/src/entities/cron.js +77 -0
  45. package/src/entities/cronjob.js +71 -0
  46. package/src/entities/orders.js +195 -0
  47. package/src/entities/sftp-inbound.js +88 -0
  48. package/src/entities/sku.js +220 -0
  49. package/src/entities/taxpromotion.js +249 -0
  50. package/src/functions/account/account-get.js +262 -0
  51. package/src/functions/account/account-handler.js +299 -0
  52. package/src/functions/account/clients.js +10 -0
  53. package/src/functions/account/index.js +208 -0
  54. package/src/functions/actions/save-promotions-order-history.js +324 -0
  55. package/src/functions/affiliates/affiliates-hook-consumer.js +87 -0
  56. package/src/functions/affiliates/affiliates-hook-producer.js +45 -0
  57. package/src/functions/clients/clients-audience.js +62 -0
  58. package/src/functions/clients/clients-consumer.js +648 -0
  59. package/src/functions/clients/clients-producer.js +362 -0
  60. package/src/functions/clients/clients-suggested-product-consumer.js +166 -0
  61. package/src/functions/clients/helpers/suggested-product-mdlz.js +233 -0
  62. package/src/functions/clients_peru/email.html +129 -0
  63. package/src/functions/clients_peru/splitfile.js +357 -0
  64. package/src/functions/clients_peru/updateClients.js +1334 -0
  65. package/src/functions/clients_peru/utils.js +243 -0
  66. package/src/functions/cronjobs/cron-jobs-manager.js +40 -0
  67. package/src/functions/cronjobs/cron-jobs.js +171 -0
  68. package/src/functions/crons/cron.js +39 -0
  69. package/src/functions/distributors/distributor-handler.js +81 -0
  70. package/src/functions/distributors/distributor.js +535 -0
  71. package/src/functions/distributors/index.js +60 -0
  72. package/src/functions/financialpolicy/assign-financialpolicy.js +111 -0
  73. package/src/functions/financialpolicy/get-financialpolicy.js +91 -0
  74. package/src/functions/financialpolicy/index.js +28 -0
  75. package/src/functions/inventory/catalog-sync-consumer.js +17 -0
  76. package/src/functions/inventory/catalog-sync-handler.js +311 -0
  77. package/src/functions/inventory/inventory-consumer.js +119 -0
  78. package/src/functions/inventory/inventory-producer.js +197 -0
  79. package/src/functions/multiPresentation/multipre-queue.js +155 -0
  80. package/src/functions/multiPresentation/multipres.js +459 -0
  81. package/src/functions/nodeflow/index.js +83 -0
  82. package/src/functions/nodeflow/nodeflow-cron.js +200 -0
  83. package/src/functions/nodeflow/nodeflow-pub.js +203 -0
  84. package/src/functions/nodeflow/nodeflow-pvt.js +266 -0
  85. package/src/functions/notifications/download-leads-handler.js +67 -0
  86. package/src/functions/notifications/new-leads-notification-consumer.js +17 -0
  87. package/src/functions/notifications/new-leads-notification-handler.js +359 -0
  88. package/src/functions/notifications/order-status-notification-handler.js +482 -0
  89. package/src/functions/notifications/promotion-notification-handler.js +193 -0
  90. package/src/functions/orders/index.js +32 -0
  91. package/src/functions/orders/orders-cancel-handler.js +74 -0
  92. package/src/functions/orders/orders-handler.js +280 -0
  93. package/src/functions/orders/orders-hook-consumer.js +137 -0
  94. package/src/functions/orders/orders-hook-producer.js +170 -0
  95. package/src/functions/orders/orders-notifications-handler.js +137 -0
  96. package/src/functions/orders/orders-status-consumer.js +461 -0
  97. package/src/functions/orders/orders-status-producer.js +443 -0
  98. package/src/functions/prices/index.js +75 -0
  99. package/src/functions/prices/prices-consumer.js +236 -0
  100. package/src/functions/prices/prices-producer.js +323 -0
  101. package/src/functions/prices/promotion-and-tax.js +1284 -0
  102. package/src/functions/routesflow/assign-routeflow-queue.js +77 -0
  103. package/src/functions/schemas/vtex/handle-schemas.js +102 -0
  104. package/src/functions/security/process_gas.js +221 -0
  105. package/src/functions/security/security-handler.js +950 -0
  106. package/src/functions/sftp/sftp-consumer.js +453 -0
  107. package/src/functions/sftpIntegrations/processes/redirectServices.js +184 -0
  108. package/src/functions/sftpIntegrations/processes/validateFileSchema.js +226 -0
  109. package/src/functions/sftpIntegrations/schemas/credential-schema.js +123 -0
  110. package/src/functions/sftpIntegrations/schemas/record-schema.js +131 -0
  111. package/src/functions/sftpIntegrations/schemas/sftp_required_fields.json +3 -0
  112. package/src/functions/sftpIntegrations/sftp-config-producer.js +112 -0
  113. package/src/functions/sftpIntegrations/sftp-consumer.js +700 -0
  114. package/src/functions/sftpIntegrations/test/validateFile.test.js +122 -0
  115. package/src/functions/sftpIntegrations/utils/connect-dynamo.js +29 -0
  116. package/src/functions/sftpIntegrations/utils/split-data.js +25 -0
  117. package/src/functions/utils/index.js +130 -0
  118. package/src/functions/vtex/vtex-helpers.js +694 -0
  119. package/src/integrations/accountErrors/AccountErrorManager.js +437 -0
  120. package/src/integrations/audience/Audience.js +70 -0
  121. package/src/integrations/financialPolicy/FinancialPolicyApi.js +377 -0
  122. package/src/integrations/index.js +0 -0
  123. package/src/integrations/mobilvendor/MobilvendorApi.js +405 -0
  124. package/src/integrations/productmultipresentation/ProductMultiPresentation.js +200 -0
  125. package/src/mdlz/auth/SecretManagerApi.js +77 -0
  126. package/src/mdlz/client/MdlzApi.js +70 -0
  127. package/src/vtex/clients/ProvidersApi.js +51 -0
  128. package/src/vtex/clients/VtexApi.js +511 -0
  129. package/src/vtex/models/VtexOrder.js +87 -0
package/README.md ADDED
@@ -0,0 +1,130 @@
1
+ # **Monalisa V2 Core Library**
2
+ Esta biblioteca centraliza la lógica de Monalisa V2, permitiendo la integración de sus funcionalidades clave (integraciones con ERP, gestión de órdenes, políticas financieras y utilidades de VTEX) en múltiples aplicaciones.
3
+ ## **🛠️ Pasos de Instalación y Configuración**
4
+ ### **1. Requisitos**
5
+ Asegúrese de que su proyecto utiliza Node.js y un gestor de paquetes (npm o yarn).
6
+ ### **2. Instalación de la Librería**
7
+ Utilice npm o yarn para incluir la librería dcos-core-monalisav2-latam en su proyecto:
8
+
9
+ # Usando npm
10
+ ```bash
11
+ npm install dcos-core-monalisav2-latam
12
+ ```
13
+ # Usando yarn
14
+ ```bash
15
+ yarn add dcos-core-monalisav2-latam
16
+ ```
17
+ ### **3. Configuración de Alias de Módulo (Opcional)**
18
+ Si su proyecto Monalisa V2 original utilizaba module-alias, esta librería ya lo incluye como dependencia. Sin embargo, para que los *helpers* y referencias internos funcionen correctamente dentro de su aplicación, asegúrese de que el proyecto consumidor esté configurado para reconocer los paths si es necesario.
19
+ ## **🚀 Uso de la Librería**
20
+ Todas las funciones están exportadas directamente desde el módulo principal. Se dividen en dos categorías principales: **Funciones Lambda** (puntos de entrada directos) y **Consumers SQS** (manejadores de colas).
21
+ ### **1. Importación (Destructuring)**
22
+ Se recomienda utilizar *destructuring* para importar únicamente las funciones que necesita usar:
23
+
24
+ JavaScript
25
+
26
+ // index.js o archivo de handler de su aplicación
27
+ ```bash
28
+ const {
29
+
30
+ ` `clients\_producer,
31
+
32
+ ` `orders\_get,
33
+
34
+ ` `helpperVtex\_getClientById
35
+
36
+ } = require('dcos-core-monalisav2-latam');
37
+ ```
38
+ ### **2. Ejecución**
39
+ #### **A. Uso de Funciones Lambda (clientFuntions)**
40
+ Utilice estas funciones para iniciar procesos asíncronos o manejar solicitudes síncronas.
41
+
42
+ JavaScript
43
+ ```bash
44
+ const { clients\_producer } = require('dcos-core-monalisav2-latam');
45
+
46
+ /\*\*
47
+
48
+ ` `\* Ejemplo: Iniciar la sincronización de clientes con el ERP
49
+
50
+ ` `\* @param {Object} payload - Datos de entrada, incluyendo 'data' (clientes) y 'an' (account name).
51
+
52
+ ` `\*/
53
+
54
+ async function iniciarSincronizacion(datosClientes, accountName) {
55
+
56
+ ` `try {
57
+
58
+ ` `const payload = {
59
+
60
+ ` `data: datosClientes,
61
+
62
+ ` `an: accountName
63
+
64
+ ` `};
65
+
66
+
67
+
68
+ ` `const resultado = await clients\_producer(payload);
69
+
70
+ ` `console.log('Productor iniciado exitosamente:', resultado);
71
+
72
+ ` `} catch (error) {
73
+
74
+ ` `console.error('Error al iniciar productor:', error);
75
+
76
+ ` `}
77
+
78
+ }
79
+ ```
80
+ #### **B. Uso de Consumers SQS (clientConstructor)**
81
+ Utilice estas funciones como *handlers* para el evento que recibe su aplicación desde una cola SQS.
82
+
83
+ JavaScript
84
+ ```bash
85
+ const { inventory\_queue } = require('dcos-core-monalisav2-latam');
86
+
87
+ /\*\*
88
+
89
+ ` `\* Handler registrado en AWS/GCP/Azure para la cola de Inventario.
90
+
91
+ ` `\* @param {Object} sqsEvent - El evento estándar recibido de la cola SQS.
92
+
93
+ ` `\*/
94
+
95
+ async function inventorySqsHandler(sqsEvent) {
96
+
97
+ ` `// El consumer se encarga de iterar los records y ejecutar la lógica de negocio.
98
+
99
+ ` `return inventory\_queue(sqsEvent);
100
+
101
+ }
102
+ ```
103
+ ## **📚 Índice de Funciones Exportadas (API)**
104
+ ### **A. ☁️ Funciones Lambda Expuestas (clientFuntions)**
105
+
106
+ |**Dominio**|**Función Expuesta**|**Propósito**|
107
+ | :- | :- | :- |
108
+ |**Integraciones ERP**|inventory\_producer, prices\_producer, clients\_producer, orders\_status\_producer, orders\_hook\_producer, affiliates\_hook\_producer|Inicia el procesamiento de datos y *hooks* desde el ERP (inventario, precios, clientes, órdenes, afiliados).|
109
+ |**Cuentas y CRON**|account\_validation\_handler\_all, account\_validation\_create, account\_validation\_sftpConfig|Gestión y configuración (incluido SFTP) de la validación de cuentas.|
110
+ ||cron\_create, cron\_jobs\_manager\_create, cron\_jobs\_run|Creación y ejecución de tareas CRON internas y de gestión de *jobs*.|
111
+ ||account\_getAccounts, account\_getAccount, account\_deleteAccount|CRUD para la gestión de cuentas.|
112
+ |**Consultas CRON/SFTP**|cron\_ftp\_getAllCrons, cron\_ftp\_getCronById, cron\_ftp\_getAllSftpCredentials, cron\_ftp\_getSftpCredentialById|Consulta de configuraciones de CRON y credenciales SFTP.|
113
+ |**Órdenes VTEX**|orders\_notifications, orders\_get, orders\_cancel, orders\_handler\_all|Notificaciones, obtención, cancelación y *handlers* generales de órdenes.|
114
+ |**NodeFlow (Lógica)**|services\_nodeflow\_handler\_all, cronflowtw\_run, nodeflow\_pub\_handler, nodeflow\_pub\_handlerSqs, nodeflow\_pvt\_getSettings, nodeflow\_pvt\_createSettings, nodeflow\_pvt\_getActionsType, nodeflow\_pvt\_createActionsType, nodeflow\_pvt\_createNodeFlow, nodeflow\_pvt\_treeNodeFlow, nodeflow\_pvt\_getSources, nodeflow\_pvt\_createSources, nodeflow\_pvt\_deleteSources|Gestión completa de la configuración y ejecución de flujos de lógica (*NodeFlow*).|
115
+ |**Promociones/Impuestos**|promotions\_setTaxes, promotions\_consumerapp, promotions\_createorupdate, promotions\_gettaxesorpromotions, promotions\_gettaxorpromotion, promotions\_createorupdatequeue, promotions\_archivetaxorpromotion|CRUD y gestión de reglas de promociones e impuestos en VTEX.|
116
+ |**Utilidades VTEX**|helpperVtex\_list\_products\_vtex, helpperVtex\_list\_categories\_vtex, helpperVtex\_list\_brands\_vtex, helpperVtex\_getOrderFormById, helpperVtex\_getClientById, helpperVtex\_deleteCustomData, helpperVtex\_updateOrderFormCustomData, helpperVtex\_cleanOrderFormCustomData, helpperVtex\_formatFinancialPolicyResponse, helpperVtex\_updateDataEntitySchema, helpperVtex\_createDataEntityDocument, helpperVtex\_updateDataEntityDocument, helpperVtex\_formatLeadFields, helpperVtex\_generateMasterDataDownloadUrl, helpperVtex\_transformLeadData, helpperVtex\_validateLead, helpperVtex\_generateLeadReportFileName, helpperVtex\_validateLeadsConfig|Conjunto completo de herramientas para interacción con APIs y Master Data de VTEX (Catálogo, Leads, Órdenes, etc.).|
117
+ |**Política Financiera**|services\_fnpolicy\_handler\_all, fnpolicy\_assing, fnpolicy\_get|Gestión de la asignación y consulta de la política financiera del cliente.|
118
+ |**Códigos Distribuidor**|services\_codeerp\_handler\_all, distributor\_createDistributorCode, distributor\_getAllDistributorsCodes, distributor\_createOrUpdateDistributorCodes, distributor\_getDistributorByCode, distributor\_updateDistributorCode, distributor\_deleteDistributorCode|CRUD y gestión de los códigos internos de ERP por distribuidor.|
119
+ |**Procesos Varios**|update\_clients\_peru\_consumer, services\_ultils\_handler\_all, clients\_audience\_handler, download\_leads\_handler, new\_leads\_notification\_handler, catalog\_sync\_handler, clients\_handler, promotion\_notification\_handler, vtex\_hook\_handler, account\_error\_handler, account\_properties\_handler, multipres\_setPresentationsSellers, multipres\_handleExecute, multipres\_producer, security\_producer|Servicios de utilidad, sync de catálogo, manejo de leads, errores, propiedades de cuenta y *MultiPresentation*.|
120
+ |**Esquemas**|sftp\_schemas\_file\_handler, sftp\_credentiales\_handler, handle\_schemas\_vtex\_handler|Gestión de esquemas de archivos SFTP, credenciales y esquemas VTEX.|
121
+
122
+ ### **B. 📧 Consumers SQS Expuestos (clientConstructor)**
123
+
124
+ |**Dominio**|**Función Expuesta**|**Propósito**|
125
+ | :- | :- | :- |
126
+ |**Integraciones ERP**|inventory\_queue, prices\_queue, clients\_queue, clients\_product\_queue, orders\_status\_queue, orders\_hook\_queue, affiliates\_hook\_queue|Workers para consumo de colas de datos principales del ERP, órdenes y afiliados.|
127
+ |**NodeFlow / Rutas**|nodeflow\_queue, assign\_routeflow\_queue|Worker SQS para NodeFlow y asignación de flujos de ruta.|
128
+ |**Distribución/Archivos**|distributor\_sku\_queue, splitfile\_queue, processfile\_queue, callmaestras\_queue, sftpjobs\_queue|Procesamiento de archivos grandes, *split* de archivos, llamadas a maestras y jobs SFTP.|
129
+ |**Varios**|processtaxapp\_queue, multipres\_queue, multiprescom\_queue, notify\_order\_status, cronjobs\_queue, save\_promotions\_queue||
130
+
package/index.js ADDED
@@ -0,0 +1,350 @@
1
+ /**
2
+ * Functions lambda
3
+ */
4
+ // Functions - integrations ERP
5
+ const {
6
+ producer: inventory_producer,
7
+ } = require("./src/functions/inventory/inventory-producer");
8
+ const {
9
+ producer: prices_producer,
10
+ } = require("./src/functions/prices/prices-producer");
11
+ const {
12
+ producer: clients_producer,
13
+ } = require("./src/functions/clients/clients-producer");
14
+ const {
15
+ producer: orders_status_producer,
16
+ } = require("./src/functions/orders/orders-status-producer");
17
+ const {
18
+ producer: orders_hook_producer,
19
+ } = require("./src/functions/orders/orders-hook-producer");
20
+ const {
21
+ producer: affiliates_hook_producer,
22
+ } = require("./src/functions/affiliates/affiliates-hook-producer");
23
+ // Functions - accounts
24
+ const {
25
+ handler: account_validation_handler_all,
26
+ } = require("./src/functions/account/index");
27
+ const {
28
+ create: account_validation_create,
29
+ sftpConfig: account_validation_sftpConfig,
30
+ } = require("./src/functions/account/account-handler");
31
+ const {
32
+ create: cron_create
33
+ } = require("./src/functions/crons/cron");
34
+ const {
35
+ create: cron_jobs_manager_create
36
+ } = require("./src/functions/cronjobs/cron-jobs-manager");
37
+ const {
38
+ getAccounts: account_getAccounts,
39
+ getAccount: account_getAccount,
40
+ deleteAccount: account_deleteAccount
41
+ } = require("./src/functions/account/account-get");
42
+ const {
43
+ getAllCrons: cron_ftp_getAllCrons,
44
+ getCronById: cron_ftp_getCronById,
45
+ getAllSftpCredentials: cron_ftp_getAllSftpCredentials,
46
+ getSftpCredentialById: cron_ftp_getSftpCredentialById
47
+ } = require("./src/common/utils/cron-ftp-get");
48
+ // Functions - orders
49
+ const {
50
+ notifications: orders_notifications,
51
+ } = require("./src/functions/orders/orders-notifications-handler");
52
+ const {
53
+ getOrders: orders_get,
54
+ } = require("./src/functions/orders/orders-handler");
55
+ const {
56
+ cancel: orders_cancel,
57
+ } = require("./src/functions/orders/orders-cancel-handler");
58
+ const {
59
+ handler: orders_handler_all,
60
+ } = require("./src/functions/orders/index");
61
+ // Functions - nodeflow
62
+ const {
63
+ handler: services_nodeflow_handler_all,
64
+ } = require("./src/functions/nodeflow/index");
65
+ const {
66
+ run: cronflowtw_run,
67
+ } = require("./src/functions/nodeflow/nodeflow-cron");
68
+ const {
69
+ handler: nodeflow_pub_handler,
70
+ handlerSqs: nodeflow_pub_handlerSqs,
71
+ } = require("./src/functions/nodeflow/nodeflow-pub");
72
+ const {
73
+ getSettings: nodeflow_pvt_getSettings,
74
+ createSettings: nodeflow_pvt_createSettings,
75
+ getActionsType: nodeflow_pvt_getActionsType,
76
+ createActionsType: nodeflow_pvt_createActionsType,
77
+ createNodeFlow: nodeflow_pvt_createNodeFlow,
78
+ treeNodeFlow: nodeflow_pvt_treeNodeFlow,
79
+ getSources: nodeflow_pvt_getSources,
80
+ createSources: nodeflow_pvt_createSources,
81
+ deleteSources: nodeflow_pvt_deleteSources,
82
+ } = require("./src/functions/nodeflow/nodeflow-pvt");
83
+ // Functions - promotions and taxes VTEX
84
+ const {
85
+ handler: services_taxpromo_handler_all,
86
+ } = require("./src/functions/prices/index");
87
+ const {
88
+ setTaxes: promotions_setTaxes,
89
+ consumerapp: promotions_consumerapp,
90
+ createorupdate: promotions_createorupdate,
91
+ gettaxesorpromotions: promotions_gettaxesorpromotions,
92
+ gettaxorpromotion: promotions_gettaxorpromotion,
93
+ createorupdatequeue: promotions_createorupdatequeue,
94
+ archivetaxorpromotion: promotions_archivetaxorpromotion,
95
+ } = require("./src/functions/prices/promotion-and-tax");
96
+ const {
97
+ list_products_vtex: helpperVtex_list_products_vtex,
98
+ list_categories_vtex: helpperVtex_list_categories_vtex,
99
+ list_brands_vtex: helpperVtex_list_brands_vtex,
100
+ getOrderFormById: helpperVtex_getOrderFormById,
101
+ getClientById: helpperVtex_getClientById,
102
+ deleteCustomData: helpperVtex_deleteCustomData,
103
+ updateOrderFormCustomData: helpperVtex_updateOrderFormCustomData,
104
+ cleanOrderFormCustomData: helpperVtex_cleanOrderFormCustomData,
105
+ formatFinancialPolicyResponse: helpperVtex_formatFinancialPolicyResponse,
106
+ updateDataEntitySchema: helpperVtex_updateDataEntitySchema,
107
+ createDataEntityDocument: helpperVtex_createDataEntityDocument,
108
+ updateDataEntityDocument: helpperVtex_updateDataEntityDocument,
109
+ formatLeadFields: helpperVtex_formatLeadFields,
110
+ generateMasterDataDownloadUrl: helpperVtex_generateMasterDataDownloadUrl,
111
+ transformLeadData: helpperVtex_transformLeadData,
112
+ validateLead: helpperVtex_validateLead,
113
+ generateLeadReportFileName: helpperVtex_generateLeadReportFileName,
114
+ validateLeadsConfig: helpperVtex_validateLeadsConfig,
115
+ } = require("./src/functions/vtex/vtex-helpers");
116
+ // Functions - financial policy
117
+ const {
118
+ handler: services_fnpolicy_handler_all,
119
+ } = require("./src/functions/financialpolicy/index");
120
+ const {
121
+ handler: fnpolicy_assing,
122
+ } = require("./src/functions/financialpolicy/assign-financialpolicy");
123
+ const {
124
+ handler: fnpolicy_get,
125
+ } = require("./src/functions/financialpolicy/get-financialpolicy");
126
+ // Functions - codes ERP per distribuitor
127
+ const {
128
+ handler: services_codeerp_handler_all,
129
+ } = require("./src/functions/distributors/index");
130
+ const {
131
+ createDistributorCode: distributor_createDistributorCode,
132
+ getAllDistributorsCodes: distributor_getAllDistributorsCodes,
133
+ createOrUpdateDistributorCodes: distributor_createOrUpdateDistributorCodes,
134
+ getDistributorByCode: distributor_getDistributorByCode,
135
+ updateDistributorCode: distributor_updateDistributorCode,
136
+ deleteDistributorCode: distributor_deleteDistributorCode,
137
+ } = require("./src/functions/distributors/distributor");
138
+ // Funtion - start process integrations clients Peru
139
+ const {
140
+ consumer: update_clients_peru_consumer,
141
+ } = require("./src/functions/clients_peru/updateClients");
142
+ // Function - crons process internal Monalisa
143
+ const {
144
+ run: cron_jobs_run
145
+ } = require("./src/functions/cronjobs/cron-jobs");
146
+ // Functions - utilities services
147
+ const {
148
+ handler: services_ultils_handler_all,
149
+ } = require("./src/functions/utils/index");
150
+ const {
151
+ handler: clients_audience_handler,
152
+ } = require("./src/functions/clients/clients-audience");
153
+ const {
154
+ handler: download_leads_handler,
155
+ } = require("./src/functions/notifications/download-leads-handler");
156
+ const {
157
+ handler: new_leads_notification_handler,
158
+ } = require("./src/functions/notifications/new-leads-notification-handler");
159
+ const {
160
+ handler: catalog_sync_handler,
161
+ } = require("./src/functions/inventory/catalog-sync-handler");
162
+ const {
163
+ handler: clients_handler,
164
+ } = require("./src/functions/account/clients.js");
165
+ const {
166
+ handler: promotion_notification_handler,
167
+ } = require("./src/functions/notifications/promotion-notification-handler");
168
+ const {
169
+ handler: vtex_hook_handler,
170
+ } = require("./src/common/utils/vtex-hook-handler");
171
+ const {
172
+ handler: account_error_handler,
173
+ } = require("./src/common/utils/account-error-handler");
174
+ const {
175
+ handler: account_properties_handler,
176
+ } = require("./src/common/utils/account-properties-handler");
177
+ const {
178
+ setPresentationsSellers: multipres_setPresentationsSellers,
179
+ handleExecute: multipres_handleExecute,
180
+ producer: multipres_producer
181
+ } = require("./src/functions/multiPresentation/multipres");
182
+ const {
183
+ producer: security_producer,
184
+ } = require("./src/functions/security/security-handler");
185
+ // Functions - schemas files sftp
186
+ const {
187
+ handler: sftp_schemas_file_handler,
188
+ } = require("./src/functions/sftpIntegrations/schemas/record-schema");
189
+ // Functions - credentials sftp
190
+ const {
191
+ handler: sftp_credentiales_handler,
192
+ } = require("./src/functions/sftpIntegrations/schemas/credential-schema");
193
+ // Functions - schemas VTEX
194
+ const {
195
+ handler: handle_schemas_vtex_handler,
196
+ } = require("./src/functions/schemas/vtex/handle-schemas");
197
+
198
+ const clientFuntions = {
199
+ // Functions - integrations ERP
200
+ inventory_producer,
201
+ prices_producer,
202
+ clients_producer,
203
+ orders_status_producer,
204
+ orders_hook_producer,
205
+ affiliates_hook_producer,
206
+ // Functions - accounts
207
+ account_validation_handler_all,
208
+ account_validation_create,
209
+ account_validation_sftpConfig,
210
+ cron_create,
211
+ cron_jobs_manager_create,
212
+ account_getAccounts,
213
+ account_getAccount,
214
+ account_deleteAccount,
215
+ cron_ftp_getAllCrons,
216
+ cron_ftp_getCronById,
217
+ cron_ftp_getAllSftpCredentials,
218
+ cron_ftp_getSftpCredentialById,
219
+ // Functions - orders
220
+ orders_notifications,
221
+ orders_get,
222
+ orders_cancel,
223
+ orders_handler_all,
224
+ // Functions - nodeflow
225
+ services_nodeflow_handler_all,
226
+ nodeflow_pub_handler,
227
+ nodeflow_pub_handlerSqs,
228
+ nodeflow_pvt_getSettings,
229
+ nodeflow_pvt_createSettings,
230
+ nodeflow_pvt_getActionsType,
231
+ nodeflow_pvt_createActionsType,
232
+ nodeflow_pvt_createNodeFlow,
233
+ nodeflow_pvt_treeNodeFlow,
234
+ nodeflow_pvt_getSources,
235
+ nodeflow_pvt_createSources,
236
+ nodeflow_pvt_deleteSources,
237
+ cronflowtw_run,
238
+ // Functions - promotions and taxes VTEX
239
+ services_taxpromo_handler_all,
240
+ promotions_setTaxes,
241
+ promotions_consumerapp,
242
+ promotions_createorupdate,
243
+ promotions_gettaxesorpromotions,
244
+ promotions_gettaxorpromotion,
245
+ promotions_createorupdatequeue,
246
+ promotions_archivetaxorpromotion,
247
+ helpperVtex_list_products_vtex,
248
+ helpperVtex_list_categories_vtex,
249
+ helpperVtex_list_brands_vtex,
250
+ helpperVtex_getOrderFormById,
251
+ helpperVtex_getClientById,
252
+ helpperVtex_deleteCustomData,
253
+ helpperVtex_updateOrderFormCustomData,
254
+ helpperVtex_cleanOrderFormCustomData,
255
+ helpperVtex_formatFinancialPolicyResponse,
256
+ helpperVtex_updateDataEntitySchema,
257
+ helpperVtex_createDataEntityDocument,
258
+ helpperVtex_updateDataEntityDocument,
259
+ helpperVtex_formatLeadFields,
260
+ helpperVtex_generateMasterDataDownloadUrl,
261
+ helpperVtex_transformLeadData,
262
+ helpperVtex_validateLead,
263
+ helpperVtex_generateLeadReportFileName,
264
+ helpperVtex_validateLeadsConfig,
265
+ // Functions - financial policy
266
+ services_fnpolicy_handler_all,
267
+ fnpolicy_assing,
268
+ fnpolicy_get,
269
+ // Functions - codes ERP per distribuitor
270
+ services_codeerp_handler_all,
271
+ distributor_createDistributorCode,
272
+ distributor_getAllDistributorsCodes,
273
+ distributor_createOrUpdateDistributorCodes,
274
+ distributor_getDistributorByCode,
275
+ distributor_updateDistributorCode,
276
+ distributor_deleteDistributorCode,
277
+ // Funtion - start process integrations clients Peru
278
+ update_clients_peru_consumer,
279
+ // Function - crons process internal Monalisa
280
+ cron_jobs_run,
281
+ // Functions - utilities services
282
+ services_ultils_handler_all,
283
+ clients_audience_handler,
284
+ download_leads_handler,
285
+ new_leads_notification_handler,
286
+ catalog_sync_handler,
287
+ clients_handler, // list accounts per client cognito
288
+ promotion_notification_handler,
289
+ vtex_hook_handler,
290
+ account_error_handler,
291
+ account_properties_handler,
292
+ multipres_setPresentationsSellers,
293
+ multipres_handleExecute,
294
+ multipres_producer,
295
+ security_producer,
296
+
297
+
298
+ sftp_schemas_file_handler,
299
+ sftp_credentiales_handler,
300
+ handle_schemas_vtex_handler,
301
+ };
302
+
303
+ /**
304
+ * Functions - SQS
305
+ */
306
+ const {consumer: inventory_queue} = require("./src/functions/inventory/inventory-consumer");
307
+ const {consumer: prices_queue} = require("./src/functions/prices/prices-consumer");
308
+ const {consumer: clients_queue} = require("./src/functions/clients/clients-consumer");
309
+ const {consumer: orders_status_queue} = require("./src/functions/orders/orders-status-consumer");
310
+ const {consumer: orders_hook_queue} = require("./src/functions/orders/orders-hook-consumer");
311
+ const {consumer: affiliates_hook_queue} = require("./src/functions/affiliates/affiliates-hook-consumer");
312
+ const {handlerSqsWorker: nodeflow_queue} = require("./src/functions/nodeflow/nodeflow-pub");
313
+ const {handler: assign_routeflow_queue} = require("./src/functions/routesflow/assign-routeflow-queue");
314
+ const {handler: distributor_sku_queue} = require("./src/functions/distributors/distributor-handler");
315
+ const {processFileQueue: splitfile_queue} = require("./src/functions/clients_peru/updateClients");
316
+ const {insertClientQueue: processfile_queue} = require("./src/functions/clients_peru/updateClients");
317
+ const {callMaestrasQueue: callmaestras_queue} = require("./src/functions/clients_peru/updateClients");
318
+ const {consumerapp: processtaxapp_queue} = require("./src/functions/prices/promotion-and-tax");
319
+ const {handler: multipres_queue} = require("./src/functions/multiPresentation/multipre-queue");
320
+ const {completeProductPresentation: multiprescom_queue} = require("./src/functions/multiPresentation/multipre-queue");
321
+ const {handler: notify_order_status} = require("./src/functions/notifications/order-status-notification-handler");
322
+ const {queue: cronjobs_queue} = require("./src/functions/cronjobs/cron-jobs");
323
+ const {processFile: sftpjobs_queue} = require("./src/functions/sftpIntegrations/sftp-consumer");
324
+ const {handler: save_promotions_queue} = require("./src/functions/actions/save-promotions-order-history");
325
+ const {consumer: clients_product_queue} = require("./src/functions/clients/clients-suggested-product-consumer");
326
+
327
+ const clientConstructor = {
328
+ inventory_queue,
329
+ prices_queue,
330
+ clients_queue,
331
+ orders_status_queue,
332
+ orders_hook_queue,
333
+ affiliates_hook_queue,
334
+ nodeflow_queue,
335
+ assign_routeflow_queue,
336
+ distributor_sku_queue,
337
+ splitfile_queue,
338
+ processfile_queue,
339
+ callmaestras_queue,
340
+ processtaxapp_queue,
341
+ multipres_queue,
342
+ multiprescom_queue,
343
+ notify_order_status,
344
+ cronjobs_queue,
345
+ sftpjobs_queue,
346
+ save_promotions_queue,
347
+ clients_product_queue,
348
+ };
349
+
350
+ module.exports = { ...clientConstructor, ...clientFuntions };
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "dcos-core-monalisav2-latam",
3
+ "version": "1.0.0",
4
+ "devDependencies": {
5
+ },
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "_location": "/dcos-core-monalisav2-latam",
10
+ "repository": "https://bitbucket.org/summasolutions/aws-dcos-core-monalisav2-latam",
11
+ "author": {
12
+ "name": "Victor Garcia",
13
+ "email": "victor.garcia@infracommerce.lat"
14
+ },
15
+ "main": "./index.js",
16
+ "bin": "index.js",
17
+ "files": [
18
+ "index.js",
19
+ "src/"
20
+ ],
21
+ "license": "ISC",
22
+ "description": "",
23
+ "dependencies": {
24
+ "adm-zip": "^0.5.16",
25
+ "archiver": "^7.0.1",
26
+ "aws-multipart-parser": "^0.2.1",
27
+ "aws-sdk-mock": "^6.2.0",
28
+ "axios": "^1.3.4",
29
+ "cron-parser": "^4.9.0",
30
+ "csv": "^6.3.0",
31
+ "csv-parser": "^3.0.0",
32
+ "csvtojson": "^2.0.10",
33
+ "dotenv": "^10.0.0",
34
+ "ftp": "^0.3.10",
35
+ "json-2-csv": "^5.5.1",
36
+ "jsonschema": "^1.4.1",
37
+ "jsonwebtoken": "^9.0.2",
38
+ "lodash": "^4.17.21",
39
+ "md5": "^2.3.0",
40
+ "module-alias": "^2.2.3",
41
+ "moment": "^2.30.1",
42
+ "node-cron": "^3.0.0",
43
+ "node-fetch": "^3.2.10",
44
+ "node-flow-br": "^1.0.9",
45
+ "nodemailer": "^6.8.0",
46
+ "parse-multipart": "^1.0.4",
47
+ "ssh2-sftp-client": "^12.0.0",
48
+ "uuid": "^9.0.0",
49
+ "validate.js": "^0.13.1",
50
+ "xml2js": "^0.6.2"
51
+ }
52
+ }
@@ -0,0 +1,3 @@
1
+ const authservicesall = require("dcos-sls-auth-app");
2
+
3
+ module.exports = authservicesall;