UNPKG

@tuanltntu/n8n-nodes-bitrix24

Version:

Comprehensive n8n community node for Bitrix24 API integration with CRM, Tasks, Chat, Telephony, and more

64 lines 2.38 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Bitrix24NodeExecutor = void 0; const ResourceHandlerFactory_1 = require("./handlers/ResourceHandlerFactory"); const Bitrix24FieldRegistry_1 = require("./Bitrix24FieldRegistry"); /** * Bitrix24 Node Executor - Handles all dynamic logic * ELIMINATES CIRCULAR DEPENDENCIES through smart field loading */ class Bitrix24NodeExecutor { constructor(nodeInstance) { this.nodeInstance = nodeInstance; } /** * Main execution method */ async execute() { const items = this.getInputData(); const returnData = []; // Process each input item for (let itemIndex = 0; itemIndex < items.length; itemIndex++) { try { const resource = this.getNodeParameter("resource", itemIndex); // Create appropriate resource handler const handler = ResourceHandlerFactory_1.ResourceHandlerFactory.createHandler(resource, this, returnData, { debug: true, forceWebhook: false, }); // Process the operation const result = await handler.process(); returnData.push(...result); } catch (error) { // Handle errors gracefully if (this.continueOnFail()) { returnData.push({ json: { error: error.message }, error, pairedItem: { item: itemIndex }, }); } else { throw error; } } } return returnData; } /** * Get operations for a specific resource */ static async getResourceOperations(resource) { return Bitrix24NodeExecutor.fieldRegistry.getOperationsForResource(resource); } /** * Get fields for a specific resource and operation */ static async getFieldsForOperation(resource, operation) { return Bitrix24NodeExecutor.fieldRegistry.getFieldsForOperation(resource, operation); } } exports.Bitrix24NodeExecutor = Bitrix24NodeExecutor; Bitrix24NodeExecutor.fieldRegistry = new Bitrix24FieldRegistry_1.Bitrix24FieldRegistry(); //# sourceMappingURL=Bitrix24NodeExecutor.js.map