UNPKG

@tuanltntu/n8n-nodes-bitrix24

Version:

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

429 lines 13.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.fileDeleteFields = exports.fileFields = exports.fileInfoFields = exports.fileDownloadFields = exports.fileOptionsFields = exports.fileListFields = exports.fileActionFields = exports.fileUploadFields = exports.fileOperationFields = void 0; const ModuleManager_1 = require("../ModuleManager"); // File operations const operationField = ModuleManager_1.ModuleManager.createSimpleField({ displayName: "Operation", name: "operation", type: "options", noDataExpression: true, options: [ { name: "Upload File", value: "uploadFile", description: "Upload a file", action: "Upload a file", }, { name: "Download File", value: "downloadFile", description: "Download a file", action: "Download a file", }, { name: "Get File Info", value: "getFileInfo", description: "Get file information", action: "Get file information", }, { name: "Delete File", value: "deleteFile", description: "Delete a file", action: "Delete a file", }, { name: "Get File List", value: "getFileList", description: "Get list of files", action: "Get list of files", }, ], default: "getFileList", }, ModuleManager_1.BITRIX24_MODULES.FILE); // File ID field const fileIdField = ModuleManager_1.ModuleManager.createSimpleField({ displayName: "File ID", name: "fileId", type: "string", required: true, default: "", displayOptions: { show: { operation: ["get", "delete"], }, }, description: "ID of the file", }, ModuleManager_1.BITRIX24_MODULES.FILE, { operation: ["downloadFile", "getFileInfo", "deleteFile"], }); // File Binary field const fileBinaryField = ModuleManager_1.ModuleManager.createSimpleField({ displayName: "Binary Property", name: "binaryProperty", type: "string", default: "data", required: true, description: "Name of the binary property to upload", }, ModuleManager_1.BITRIX24_MODULES.FILE, { operation: ["uploadFile"], }); // File Name field const fileNameField = ModuleManager_1.ModuleManager.createSimpleField({ displayName: "File Name", name: "fileName", type: "string", default: "", description: "Name of the file", }, ModuleManager_1.BITRIX24_MODULES.FILE, { operation: ["uploadFile"], }); // Module ID field const moduleIdField = ModuleManager_1.ModuleManager.createSimpleField({ displayName: "Module ID", name: "moduleId", type: "string", default: "", description: "Module ID to upload file to", }, ModuleManager_1.BITRIX24_MODULES.FILE, { operation: ["uploadFile"], }); // Return All field const returnAllField = ModuleManager_1.ModuleManager.createSimpleField({ displayName: "Return All", name: "returnAll", type: "boolean", default: false, displayOptions: { show: { operation: ["getAll"], }, }, description: "Whether to return all results or only up to a given limit", }, ModuleManager_1.BITRIX24_MODULES.FILE, { operation: ["getFileList"], }); // Limit field const limitField = ModuleManager_1.ModuleManager.createSimpleField({ displayName: "Limit", name: "limit", type: "number", typeOptions: { minValue: 1, }, default: 50, displayOptions: { show: { operation: ["getAll"], returnAll: [false], }, }, description: "Max number of results to return", }, ModuleManager_1.BITRIX24_MODULES.FILE, { operation: ["getFileList"], returnAll: [false], }); // Options collection const optionsCollection = ModuleManager_1.ModuleManager.createSimpleCollection("Options", ModuleManager_1.BITRIX24_MODULES.FILE, {}, [ { displayName: "Access Token", name: "accessToken", type: "string", default: "", description: "Access token for authentication", }, { displayName: "Filter", name: "filter", type: "json", default: "{}", description: "Filter criteria for file list", }, { displayName: "Order", name: "order", type: "json", default: "{}", description: "Sort order for results", }, ]); exports.fileOperationFields = [operationField]; exports.fileUploadFields = [ fileBinaryField, fileNameField, moduleIdField, ]; exports.fileActionFields = [fileIdField]; exports.fileListFields = [returnAllField, limitField]; exports.fileOptionsFields = [optionsCollection]; // Aliases for backward compatibility exports.fileDownloadFields = [ fileIdField, fileBinaryField, ]; exports.fileInfoFields = [fileIdField]; exports.fileFields = [ /* -------------------------------------------------------------------------- */ /* file:upload */ /* -------------------------------------------------------------------------- */ { displayName: "Entity Type", name: "entityType", type: "options", options: [ { name: "Lead", value: "lead" }, { name: "Deal", value: "deal" }, { name: "Contact", value: "contact" }, { name: "Company", value: "company" }, { name: "Task", value: "task" }, ], required: true, default: "deal", displayOptions: { show: { operation: ["upload"], }, }, description: "Type of entity to attach the file to", }, { displayName: "Entity ID", name: "entityId", type: "string", required: true, default: "", displayOptions: { show: { operation: ["upload"], }, }, description: "ID of the entity to attach the file to", }, { displayName: "Folder ID", name: "folderId", type: "string", default: "", required: true, displayOptions: { show: { operation: ["upload"], }, }, description: "ID of the folder to upload the file to", }, { displayName: "Options", name: "options", type: "collection", placeholder: "Add Option", default: {}, displayOptions: { show: { operation: ["upload"], }, }, options: [ { displayName: "Access Token", name: "accessToken", type: "string", default: "", placeholder: "Enter the access token to use instead of credentials.", description: "Access token to use for API requests. If provided, will take priority over token in credentials.", }, { displayName: "Custom Parameters", name: "customParameters", type: "string", default: "", description: "Additional parameters in JSON format to include in the request", hint: "Enter a JSON object with key-value pairs that will be merged with other parameters", typeOptions: { rows: 2, }, }, ], }, /* -------------------------------------------------------------------------- */ /* file:getAll */ /* -------------------------------------------------------------------------- */ { displayName: "Return All", name: "returnAll", type: "boolean", default: false, displayOptions: { show: { operation: ["getAll"], }, }, description: "Whether to return all results or only up to a given limit", }, { displayName: "Options", name: "options", type: "collection", placeholder: "Add Option", default: {}, displayOptions: { show: { operation: ["getAll"], }, }, options: [ { displayName: "Entity Type", name: "entityType", type: "options", options: [ { name: "Contact", value: "contact", }, { name: "Company", value: "company", }, { name: "Deal", value: "deal", }, { name: "Lead", value: "lead", }, { name: "Task", value: "task", }, { name: "Disk (Folder)", value: "disk", }, ], default: "", description: "Type of entity to filter files by", }, { displayName: "Entity ID", name: "entityId", type: "string", default: "", description: "ID of the entity to filter files by", }, { displayName: "Sort Order", name: "order", type: "options", options: [ { name: "Ascending", value: "ASC", }, { name: "Descending", value: "DESC", }, ], default: "DESC", description: "Direction to sort the results in", }, { displayName: "Custom Parameters", name: "customParameters", type: "string", default: "", description: "Additional parameters in JSON format to include in the request", hint: "Enter a JSON object with key-value pairs that will be merged with other parameters", typeOptions: { rows: 2, }, }, ], }, /* -------------------------------------------------------------------------- */ /* file:delete */ /* -------------------------------------------------------------------------- */ { displayName: "File ID", name: "fileId", type: "string", required: true, default: "", displayOptions: { show: { operation: ["delete"], }, }, description: "ID of the file to delete", }, { displayName: "Options", name: "options", type: "collection", placeholder: "Add Option", default: {}, displayOptions: { show: { operation: ["delete"], }, }, options: [ { displayName: "Custom Parameters", name: "customParameters", type: "string", default: "", description: "Additional parameters in JSON format to include in the request", hint: "Enter a JSON object with key-value pairs that will be merged with other parameters", typeOptions: { rows: 2, }, }, ], }, ]; exports.fileDeleteFields = [ // Fields for deleting a file { displayName: "File ID", name: "fileId", type: "string", required: true, displayOptions: { show: { operation: ["deleteFile"], }, }, default: "", description: "ID of the file to delete", }, { displayName: "Options", name: "options", type: "collection", placeholder: "Add Option", default: {}, displayOptions: { show: { operation: ["deleteFile"], }, }, options: [ { displayName: "Custom Parameters", name: "customParameters", type: "string", default: "", description: "Additional parameters in JSON format to include in the request", hint: "Enter a JSON object with key-value pairs that will be merged with other parameters", typeOptions: { rows: 2, }, }, ], }, ]; //# sourceMappingURL=FileDescription.js.map