@tuanltntu/n8n-nodes-bitrix24
Version:
Comprehensive n8n community node for Bitrix24 API integration with CRM, Tasks, Chat, Telephony, and more
592 lines • 19.3 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.spaFields = exports.spaOperations = void 0;
const ModuleManager_1 = require("../ModuleManager");
// SPA operations
const operationField = ModuleManager_1.ModuleManager.createSimpleField({
displayName: "Operation",
name: "operation",
type: "options",
noDataExpression: true,
options: [
{
name: "Install App",
value: "installApp",
description: "Install SPA application",
action: "Install SPA application",
},
{
name: "Uninstall App",
value: "uninstallApp",
description: "Uninstall SPA application",
action: "Uninstall SPA application",
},
{
name: "Get Placement List",
value: "getPlacementList",
description: "Get available placement list",
action: "Get available placement list",
},
{
name: "Get Placement Info",
value: "getPlacementInfo",
description: "Get placement information",
action: "Get placement information",
},
{
name: "Bind Placement",
value: "bindPlacement",
description: "Bind placement handler",
action: "Bind placement handler",
},
{
name: "Unbind Placement",
value: "unbindPlacement",
description: "Unbind placement handler",
action: "Unbind placement handler",
},
],
default: "getPlacementList",
}, ModuleManager_1.BITRIX24_MODULES.SPA);
// App Code field
const appCodeField = ModuleManager_1.ModuleManager.createSimpleField({
displayName: "App Code",
name: "appCode",
type: "string",
required: true,
default: "",
description: "Code of the SPA application",
}, ModuleManager_1.BITRIX24_MODULES.SPA, {
operation: ["installApp", "uninstallApp"],
});
// Placement Code field
const placementCodeField = ModuleManager_1.ModuleManager.createSimpleField({
displayName: "Placement Code",
name: "placementCode",
type: "string",
required: true,
default: "",
description: "Code of the placement",
}, ModuleManager_1.BITRIX24_MODULES.SPA, {
operation: ["getPlacementInfo", "bindPlacement", "unbindPlacement"],
});
// Handler URL field
const handlerUrlField = ModuleManager_1.ModuleManager.createSimpleField({
displayName: "Handler URL",
name: "handlerUrl",
type: "string",
required: true,
default: "",
description: "URL of the placement handler",
}, ModuleManager_1.BITRIX24_MODULES.SPA, {
operation: ["bindPlacement"],
});
// Options collection
const optionsCollection = ModuleManager_1.ModuleManager.createSimpleCollection("Options", ModuleManager_1.BITRIX24_MODULES.SPA, {}, [
{
displayName: "Access Token",
name: "accessToken",
type: "string",
default: "",
description: "Access token for authentication",
},
{
displayName: "Lang",
name: "lang",
type: "string",
default: "",
description: "Language code",
},
{
displayName: "Options",
name: "options",
type: "json",
default: "{}",
description: "Additional options",
},
]);
exports.spaOperations = [
operationField,
appCodeField,
placementCodeField,
handlerUrlField,
optionsCollection,
];
exports.spaFields = [
/* -------------------------------------------------------------------------- */
/* spa:getTypes */
/* -------------------------------------------------------------------------- */
{
displayName: "Return All",
name: "returnAll",
type: "boolean",
displayOptions: {
show: {
operation: ["getTypes"],
},
},
default: false,
description: "Whether to return all results or only up to a given limit",
},
/* -------------------------------------------------------------------------- */
/* spa:addType/updateType */
/* -------------------------------------------------------------------------- */
{
displayName: "Type Name",
name: "title",
type: "string",
required: true,
default: "",
displayOptions: {
show: {
operation: ["addType", "updateType"],
},
},
description: "The name of the Smart Process type",
},
{
displayName: "Type ID",
name: "id",
type: "string",
required: true,
default: "",
displayOptions: {
show: {
operation: ["updateType", "deleteType"],
},
},
description: "The ID of the Smart Process type",
},
/* -------------------------------------------------------------------------- */
/* spa:createItem/updateItem/deleteItem */
/* -------------------------------------------------------------------------- */
{
displayName: "Type ID",
name: "typeId",
type: "string",
required: true,
default: "",
displayOptions: {
show: {
operation: [
"createItem",
"updateItem",
"deleteItem",
"getItems",
"getItem",
"getFields",
],
},
},
description: "The ID of the Smart Process type",
},
{
displayName: "Item ID",
name: "itemId",
type: "string",
required: true,
default: "",
displayOptions: {
show: {
operation: ["updateItem", "deleteItem"],
},
},
description: "The ID of the Smart Process item",
},
/* -------------------------------------------------------------------------- */
/* spa:getItems */
/* -------------------------------------------------------------------------- */
{
displayName: "Return All",
name: "returnAll",
type: "boolean",
displayOptions: {
show: {
operation: ["getItems"],
},
},
default: false,
description: "Whether to return all results or only up to a given limit",
},
/* -------------------------------------------------------------------------- */
/* Type Configuration Options */
/* -------------------------------------------------------------------------- */
{
displayName: "Enable Client Field",
name: "isClientEnabled",
type: "boolean",
displayOptions: {
show: {
operation: ["addType", "updateType"],
},
},
default: false,
description: "Whether to enable Client field with bindings to Contacts and Companies",
},
{
displayName: "Enable Document Printing",
name: "isDocumentsEnabled",
type: "boolean",
displayOptions: {
show: {
operation: ["addType", "updateType"],
},
},
default: false,
description: "Whether to enable document printing",
},
{
displayName: "Enable Use in User Field",
name: "isUseInUserfieldEnabled",
type: "boolean",
displayOptions: {
show: {
operation: ["addType", "updateType"],
},
},
default: false,
description: "Whether to enable the use of the SPA in user fields",
},
{
displayName: "Enable Product Binding",
name: "isLinkWithProductsEnabled",
type: "boolean",
displayOptions: {
show: {
operation: ["addType", "updateType"],
},
},
default: false,
description: "Whether to enable binding of catalog products",
},
{
displayName: "Enable Company Details Field",
name: "isMycompanyEnabled",
type: "boolean",
displayOptions: {
show: {
operation: ["addType", "updateType"],
},
},
default: false,
description: "Whether to enable the Your Company Details field",
},
{
displayName: "Enable Observers Field",
name: "isObserversEnabled",
type: "boolean",
displayOptions: {
show: {
operation: ["addType", "updateType"],
},
},
default: false,
description: "Whether to enable the Observers field",
},
{
displayName: "Enable Recycle Bin",
name: "isRecyclebinEnabled",
type: "boolean",
displayOptions: {
show: {
operation: ["addType", "updateType"],
},
},
default: false,
description: "Whether to enable the recycle bin functionality",
},
{
displayName: "Enable Automation Rules & Triggers",
name: "isAutomationEnabled",
type: "boolean",
displayOptions: {
show: {
operation: ["addType", "updateType"],
},
},
default: false,
description: "Whether to enable automation rules and triggers",
},
{
displayName: "Enable Start Date & End Date Fields",
name: "isBeginCloseDatesEnabled",
type: "boolean",
displayOptions: {
show: {
operation: ["addType", "updateType"],
},
},
default: false,
description: "Whether to enable the Start Date and End Date fields",
},
{
displayName: "Enable Business Process Designer",
name: "isBizProcEnabled",
type: "boolean",
displayOptions: {
show: {
operation: ["addType", "updateType"],
},
},
default: false,
description: "Whether to enable the use of the business process designer",
},
{
displayName: "Enable Custom Sales Funnels",
name: "isCategoriesEnabled",
type: "boolean",
displayOptions: {
show: {
operation: ["addType", "updateType"],
},
},
default: false,
description: "Whether to enable custom sales funnels and tunnels",
},
{
displayName: "Enable Catalog",
name: "isCatalog",
type: "boolean",
displayOptions: {
show: {
operation: ["addType", "updateType"],
},
},
default: false,
description: "Whether to enable catalog functionality",
},
{
displayName: "Enable Document Catalog",
name: "isDocumentCatalog",
type: "boolean",
displayOptions: {
show: {
operation: ["addType", "updateType"],
},
},
default: false,
description: "Whether to enable document catalog functionality",
},
{
displayName: "Enable Source Fields",
name: "isSourceEnabled",
type: "boolean",
displayOptions: {
show: {
operation: ["addType", "updateType"],
},
},
default: false,
description: "Whether to enable Source and Additional Information fields",
},
{
displayName: "Enable Custom Stages & Kanban",
name: "isStagesEnabled",
type: "boolean",
displayOptions: {
show: {
operation: ["addType", "updateType"],
},
},
default: false,
description: "Whether to enable the use of custom stages and Kanban",
},
{
displayName: "Set Open Permissions",
name: "isSetOpenPermissions",
type: "boolean",
displayOptions: {
show: {
operation: ["addType", "updateType"],
},
},
default: true,
description: "Whether new funnels should be available to everyone",
},
// Renamed from Type Data to Options
{
displayName: "Options",
name: "options",
type: "collection",
placeholder: "Add Option",
default: {},
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: "Entity Type ID",
name: "entityTypeId",
type: "number",
default: 0,
description: "Identifier of the created SPA (must be ≥ 1030 or in range 128-192)",
},
{
displayName: "Entity Type Code",
name: "code",
type: "string",
default: "",
description: "Code identifier for the entity type (no spaces, lowercase)",
},
{
displayName: "Description",
name: "description",
type: "string",
typeOptions: { rows: 3 },
default: "",
description: "Description of the Smart Process type",
},
{
displayName: "Relations",
name: "relations",
type: "json",
default: "{}",
description: "An object containing links to other CRM entities (JSON format)",
placeholder: '{ "parent": [{"entityTypeId": 3, "isChildrenListEnabled": "true"}], "child": [{"entityTypeId": 4}] }',
},
{
displayName: "Linked User Fields",
name: "linkedUserFields",
type: "json",
default: "{}",
description: "User fields in which this SPA should be displayed (when isUseInUserfieldEnabled=Y)",
placeholder: '{ "CALENDAR_EVENT|UF_CRM_CAL_EVENT": "true", "TASKS_TASK|UF_CRM_TASK": "true" }',
},
],
},
// Fields for item creation and update
{
displayName: "Fields",
name: "fields",
type: "fixedCollection",
placeholder: "Add Field",
default: {},
options: [
{
name: "values",
displayName: "Values",
values: [
{
displayName: "Field Name or ID",
name: "fieldName",
type: "string",
default: "",
description: "Name of the field to set the value of. Get available field names from SPA's type definition or Bitrix24 admin panel.",
},
{
displayName: "Field Value",
name: "fieldValue",
type: "string",
default: "",
description: "Value to set for the field",
},
],
},
],
},
// JSON fields option
{
displayName: "Use JSON Format for Fields",
name: "jsonFields",
type: "boolean",
default: false,
description: "Whether to use JSON format for fields",
},
{
displayName: "Fields (JSON)",
name: "fieldsJson",
type: "json",
default: "{}",
description: "Fields in JSON format",
},
// Options for getItems operation
{
displayName: "Options",
name: "options",
type: "collection",
placeholder: "Add Option",
default: {},
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: "Filter",
name: "filter",
type: "json",
default: "{}",
description: "Filter to apply when retrieving items. Follow Bitrix24 filter syntax.",
placeholder: '{ "STAGE_ID": "NEW", ">CREATED_DATE": "2023-01-01" }',
},
{
displayName: "Order",
name: "order",
type: "json",
default: "{}",
description: "Order specification for the results",
placeholder: '{ "ID": "ASC", "CREATED_DATE": "DESC" }',
},
{
displayName: "Select",
name: "select",
type: "string",
default: "",
description: "Comma-separated list of fields to return. Leave empty for all fields.",
placeholder: "ID,TITLE,CREATED_BY,DATE_CREATE",
},
],
},
// Options for getTypes operation
{
displayName: "Options",
name: "options",
type: "collection",
placeholder: "Add Option",
default: {},
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: "Select",
name: "select",
type: "string",
default: "",
description: "Comma-separated list of fields to return. Leave empty for all fields.",
placeholder: "ID,TITLE,ENTITY_TYPE_ID",
},
{
displayName: "Order",
name: "order",
type: "json",
default: "{}",
description: "Order specification for the results",
placeholder: '{ "ID": "ASC", "TITLE": "DESC" }',
},
{
displayName: "Filter",
name: "filter",
type: "json",
default: "{}",
description: "Filter to apply when retrieving types. Follow Bitrix24 filter syntax.",
placeholder: '{ "ENTITY_TYPE_ID": ">1000", "IS_CATALOG": "Y" }',
},
],
},
];
//# sourceMappingURL=SpaDescription.js.map