@tuanltntu/n8n-nodes-bitrix24
Version:
Comprehensive n8n community node for Bitrix24 API integration with CRM, Tasks, Chat, Telephony, and more
262 lines • 6.73 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.uploadFields = void 0;
/**
* Upload Description - Dedicated module for file upload operations
* Based on Bitrix24 Files API: https://apidocs.bitrix24.com/api-reference/files/how-to-upload-files.html
*/
// Operation field for Upload
const operationField = {
displayName: "Operation",
name: "operation",
type: "options",
noDataExpression: true,
required: true,
default: "uploadToFolder",
displayOptions: {
show: {
resource: ["upload"],
},
},
options: [
{
name: "Upload to Folder",
value: "uploadToFolder",
description: "Upload file to a specific folder (disk.folder.uploadfile)",
action: "Upload file to folder",
},
{
name: "Upload File",
value: "uploadFile",
description: "Basic file upload (disk.file.upload)",
action: "Upload file",
},
{
name: "Upload File Version",
value: "uploadVersion",
description: "Upload new version of existing file (disk.file.uploadversion)",
action: "Upload new file version",
},
{
name: "Upload to Storage",
value: "uploadToStorage",
description: "Upload file to storage (disk.storage.uploadfile)",
action: "Upload file to storage",
},
{
name: "Upload to CRM",
value: "uploadToCrm",
description: "Upload file and attach to CRM entity (crm.*.file.upload)",
action: "Upload file to CRM entity",
},
],
};
// File ID field for version upload
const fileIdField = {
displayName: "File ID",
name: "fileId",
type: "string",
required: true,
default: "",
description: "ID of the file to upload new version",
displayOptions: {
show: {
resource: ["upload"],
operation: ["uploadVersion"],
},
},
};
// Folder ID field
const folderIdField = {
displayName: "Folder ID",
name: "folderId",
type: "string",
required: true,
default: "",
description: "ID of the folder to upload file to",
displayOptions: {
show: {
resource: ["upload"],
operation: ["uploadToFolder"],
},
},
};
// Storage ID field
const storageIdField = {
displayName: "Storage ID",
name: "storageId",
type: "string",
required: true,
default: "",
description: "ID of the storage to upload file to",
displayOptions: {
show: {
resource: ["upload"],
operation: ["uploadToStorage"],
},
},
};
// CRM Entity Type field
const crmEntityTypeField = {
displayName: "CRM Entity Type",
name: "crmEntityType",
type: "options",
required: true,
default: "deal",
description: "Type of CRM entity to attach file to",
displayOptions: {
show: {
resource: ["upload"],
operation: ["uploadToCrm"],
},
},
options: [
{
name: "Deal",
value: "deal",
description: "Attach file to a deal",
},
{
name: "Contact",
value: "contact",
description: "Attach file to a contact",
},
{
name: "Company",
value: "company",
description: "Attach file to a company",
},
{
name: "Lead",
value: "lead",
description: "Attach file to a lead",
},
{
name: "Quote",
value: "quote",
description: "Attach file to a quote",
},
],
};
// CRM Entity ID field
const crmEntityIdField = {
displayName: "Entity ID",
name: "crmEntityId",
type: "string",
required: true,
default: "",
description: "ID of the CRM entity to attach file to",
displayOptions: {
show: {
resource: ["upload"],
operation: ["uploadToCrm"],
},
},
};
// File Name field
const fileNameField = {
displayName: "File Name",
name: "fileName",
type: "string",
required: true,
default: "",
description: "Name of the file to upload",
displayOptions: {
show: {
resource: ["upload"],
},
},
};
// File Content field
const fileContentField = {
displayName: "File Content",
name: "fileContent",
type: "string",
typeOptions: {
rows: 4,
},
default: "",
description: "Content of the file (base64 encoded for binary files)",
displayOptions: {
show: {
resource: ["upload"],
},
},
};
// File Data field (alternative to content)
const fileDataField = {
displayName: "File Data",
name: "fileData",
type: "string",
default: "",
description: "Binary file data or file path",
displayOptions: {
show: {
resource: ["upload"],
},
},
};
// Upload Options
const uploadOptionsField = {
displayName: "Upload Options",
name: "uploadOptions",
type: "collection",
placeholder: "Add Option",
default: {},
displayOptions: {
show: {
resource: ["upload"],
},
},
options: [
{
displayName: "Generate Unique Name",
name: "generateUniqueName",
type: "boolean",
default: false,
description: "Generate unique name if file already exists",
},
{
displayName: "Rights",
name: "rights",
type: "json",
default: "{}",
description: "File access rights in JSON format",
},
{
displayName: "Replace Existing",
name: "replaceExisting",
type: "boolean",
default: false,
description: "Replace file if it already exists",
},
{
displayName: "Description",
name: "description",
type: "string",
default: "",
description: "File description",
},
{
displayName: "Tags",
name: "tags",
type: "string",
default: "",
description: "File tags (comma separated)",
},
],
};
// Export all Upload fields
exports.uploadFields = [
operationField,
fileIdField,
folderIdField,
storageIdField,
crmEntityTypeField,
crmEntityIdField,
fileNameField,
fileContentField,
fileDataField,
uploadOptionsField,
];
//# sourceMappingURL=UploadDescription.js.map