@tuanltntu/n8n-nodes-bitrix24
Version:
Comprehensive n8n community node for Bitrix24 API integration with CRM, Tasks, Chat, Telephony, and more
364 lines • 9.7 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.entityOperationFields = exports.entityOperations = void 0;
const ModuleManager_1 = require("../ModuleManager");
/**
* Entity operations
*/
const operationField = ModuleManager_1.ModuleManager.createSimpleField({
displayName: "Operation",
name: "operation",
type: "options",
noDataExpression: true,
options: [
{
name: "Get",
value: "get",
description: "Get entity",
action: "Get an entity",
},
{
name: "Get All",
value: "getAll",
description: "Get all entities",
action: "Get all entities",
},
{
name: "Create",
value: "create",
description: "Create entity",
action: "Create an entity",
},
{
name: "Update",
value: "update",
description: "Update entity",
action: "Update an entity",
},
{
name: "Delete",
value: "delete",
description: "Delete entity",
action: "Delete an entity",
},
],
default: "getAll",
}, ModuleManager_1.BITRIX24_MODULES.ENTITY);
/**
* Entity type field
*/
const entityTypeField = ModuleManager_1.ModuleManager.createSimpleField({
displayName: "Entity Type",
name: "entityType",
type: "string",
required: true,
default: "",
placeholder: "e.g., CRM_LEAD, CRM_DEAL, CRM_CONTACT",
description: "The type of entity to work with",
}, ModuleManager_1.BITRIX24_MODULES.ENTITY);
/**
* Entity ID field
*/
const entityIdField = ModuleManager_1.ModuleManager.createSimpleField({
displayName: "Entity ID",
name: "entityId",
type: "string",
required: true,
default: "",
description: "ID of the entity",
}, ModuleManager_1.BITRIX24_MODULES.ENTITY, {
operation: ["get", "update", "delete"],
});
/**
* Fields field for create/update
*/
const fieldsField = ModuleManager_1.ModuleManager.createSimpleField({
displayName: "Fields",
name: "fields",
type: "json",
default: "{}",
description: "Fields to create or update",
placeholder: '{"TITLE": "Entity Title", "DESCRIPTION": "Description"}',
}, ModuleManager_1.BITRIX24_MODULES.ENTITY, {
operation: ["create", "update"],
});
/**
* Return All field
*/
const returnAllField = ModuleManager_1.ModuleManager.createSimpleField({
displayName: "Return All",
name: "returnAll",
type: "boolean",
default: false,
description: "Whether to return all results or only up to a given limit",
}, ModuleManager_1.BITRIX24_MODULES.ENTITY, {
operation: ["getAll"],
});
/**
* Limit field
*/
const limitField = ModuleManager_1.ModuleManager.createSimpleField({
displayName: "Limit",
name: "limit",
type: "number",
default: 50,
description: "Max number of results to return",
typeOptions: {
minValue: 1,
},
}, ModuleManager_1.BITRIX24_MODULES.ENTITY, {
operation: ["getAll"],
returnAll: [false],
});
/**
* Options collection
*/
const optionsCollection = ModuleManager_1.ModuleManager.createSimpleCollection("Options", ModuleManager_1.BITRIX24_MODULES.ENTITY, {}, [
{
displayName: "Access Token",
name: "accessToken",
type: "string",
default: "",
description: "Access token for authentication",
},
{
displayName: "Filter",
name: "filter",
type: "json",
default: "{}",
description: "Filter criteria",
},
{
displayName: "Select",
name: "select",
type: "string",
default: "",
description: "Comma-separated list of fields to select",
},
{
displayName: "Order",
name: "order",
type: "json",
default: "{}",
description: "Order criteria",
},
]);
exports.entityOperations = [
operationField,
entityTypeField,
entityIdField,
fieldsField,
returnAllField,
limitField,
optionsCollection,
];
/**
* Entity fields for all operations
*/
exports.entityOperationFields = [
/* Entity Identification Fields for All Operations */
{
displayName: "Entity Type",
name: "entityType",
type: "string",
required: true,
default: "",
description: "The type of entity to operate on (e.g., crm.lead, crm.deal, tasks, etc.)",
displayOptions: {
show: {
operation: [
"get",
"add",
"update",
"delete",
"list",
"count",
"getFields",
"addSection",
"updateSection",
"deleteSection",
"getSections",
"addItem",
"getItem",
"updateItem",
"deleteItem",
"getItems",
"import",
"export",
],
},
},
},
{
displayName: "Entity ID",
name: "entityId",
type: "string",
required: true,
default: "",
description: "The ID of the entity",
displayOptions: {
show: {
operation: ["get", "update", "delete"],
},
},
},
/* Fields for Add/Update Operations */
{
displayName: "Entity Data",
name: "entityData",
type: "json",
required: true,
default: "{}",
description: "The data of the entity in JSON format",
displayOptions: {
show: {
operation: [
"add",
"update",
"addSection",
"updateSection",
"addItem",
"updateItem",
],
},
},
},
/* Fields for List Operations */
{
displayName: "Return All",
name: "returnAll",
type: "boolean",
default: false,
displayOptions: {
show: {
operation: ["list", "getSections", "getItems"],
},
},
},
{
displayName: "Options",
name: "additionalOptions",
type: "collection",
placeholder: "Add Option",
default: {},
options: [
{
displayName: "Filter",
name: "filter",
type: "json",
default: "{}",
description: "Filter criteria in JSON format",
},
{
displayName: "Order",
name: "order",
type: "json",
default: "{}",
description: "Order criteria in JSON format",
},
{
displayName: "Select",
name: "select",
type: "string",
default: "",
description: "Comma-separated list of fields to return",
},
],
},
/* Fields for Section Operations */
{
displayName: "Section ID",
name: "sectionId",
type: "string",
required: true,
default: "",
description: "The ID of the section",
displayOptions: {
show: {
operation: ["updateSection", "deleteSection"],
},
},
},
/* Fields for Item Operations */
{
displayName: "Item ID",
name: "itemId",
type: "string",
required: true,
default: "",
description: "The ID of the item",
displayOptions: {
show: {
operation: ["getItem", "updateItem", "deleteItem"],
},
},
},
/* Fields for Import/Export Operations */
{
displayName: "Format",
name: "format",
type: "options",
options: [
{
name: "CSV",
value: "csv",
},
{
name: "XML",
value: "xml",
},
{
name: "JSON",
value: "json",
},
{
name: "Excel",
value: "excel",
},
],
default: "csv",
description: "The format of the data",
displayOptions: {
show: {
operation: ["import", "export"],
},
},
},
{
displayName: "File Content",
name: "fileContent",
type: "string",
required: true,
default: "",
description: "The content of the file to import",
displayOptions: {
show: {
operation: ["import"],
},
},
},
{
displayName: "Options",
name: "exportOptions",
type: "collection",
placeholder: "Add Option",
default: {},
options: [
{
displayName: "Fields",
name: "fields",
type: "string",
default: "",
description: "Comma-separated list of fields to export",
},
{
displayName: "Filter",
name: "filter",
type: "json",
default: "{}",
description: "Filter criteria in JSON format",
},
],
},
];
//# sourceMappingURL=EntityDescription.js.map