UNPKG

@tuanltntu/n8n-nodes-bitrix24

Version:

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

869 lines 23.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.productFields = exports.productOperations = void 0; /** * Product Description - Complete implementation based on Bitrix24 API documentation * https://apidocs.bitrix24.com/api-reference/catalog/product/index.html */ // Operation field const operationField = { displayName: "Operation", name: "operation", type: "options", noDataExpression: true, required: true, default: "get", displayOptions: { show: { resource: ["product"], }, }, options: [ { name: "Get Product", value: "get", description: "Get product information (catalog.product.get)", action: "Get product information", }, { name: "Get Products", value: "getAll", description: "Get list of products (catalog.product.list)", action: "Get list of products", }, { name: "Add Product", value: "add", description: "Add new product (catalog.product.add)", action: "Add new product", }, { name: "Update Product", value: "update", description: "Update product (catalog.product.update)", action: "Update product", }, { name: "Delete Product", value: "delete", description: "Delete product (catalog.product.delete)", action: "Delete product", }, { name: "Get Product Fields", value: "getFields", description: "Get product fields (catalog.product.getFields)", action: "Get product fields", }, { name: "Get Product Property", value: "getProperty", description: "Get product property (catalog.product.property.get)", action: "Get product property", }, { name: "Get Product Properties", value: "getProperties", description: "Get product properties (catalog.product.property.list)", action: "Get product properties", }, { name: "Add Product Property", value: "addProperty", description: "Add product property (catalog.product.property.add)", action: "Add product property", }, { name: "Update Product Property", value: "updateProperty", description: "Update product property (catalog.product.property.update)", action: "Update product property", }, { name: "Delete Product Property", value: "deleteProperty", description: "Delete product property (catalog.product.property.delete)", action: "Delete product property", }, ], }; // Product ID Field const productIdField = { displayName: "Product ID", name: "id", type: "string", required: true, default: "", description: "The ID of the product", displayOptions: { show: { resource: ["product"], operation: ["get", "update", "delete"], }, }, }; // Product Name Field const productNameField = { displayName: "Product Name", name: "name", type: "string", required: true, default: "", description: "Name of the product", displayOptions: { show: { resource: ["product"], operation: ["add", "update"], }, }, }; // Price Field const priceField = { displayName: "Price", name: "price", type: "number", required: true, default: 0, description: "Price of the product", displayOptions: { show: { resource: ["product"], operation: ["add", "update"], }, }, }; // Currency Field const currencyField = { displayName: "Currency", name: "currency", type: "string", default: "RUB", description: "Currency code (e.g., RUB, USD, EUR)", displayOptions: { show: { resource: ["product"], operation: ["add", "update"], }, }, }; // Catalog ID Field const catalogIdField = { displayName: "Catalog ID", name: "catalogId", type: "string", required: true, default: "", description: "ID of the catalog", displayOptions: { show: { resource: ["product"], operation: ["add", "update"], }, }, }; // Section ID Field const sectionIdField = { displayName: "Section ID", name: "sectionId", type: "string", default: "", description: "ID of the product section/category", displayOptions: { show: { resource: ["product"], operation: ["add", "update"], }, }, }; // Active Field const activeField = { displayName: "Active", name: "active", type: "boolean", default: true, description: "Whether the product is active", displayOptions: { show: { resource: ["product"], operation: ["add", "update"], }, }, }; // Sort Field const sortField = { displayName: "Sort Order", name: "sort", type: "number", default: 100, description: "Sort order", displayOptions: { show: { resource: ["product"], operation: ["add", "update"], }, }, }; // Description Field const descriptionField = { displayName: "Description", name: "description", type: "string", typeOptions: { rows: 3, }, default: "", description: "Product description", displayOptions: { show: { resource: ["product"], operation: ["add", "update"], }, }, }; // Code Field const codeField = { displayName: "Code", name: "code", type: "string", default: "", description: "Product code/SKU", displayOptions: { show: { resource: ["product"], operation: ["add", "update"], }, }, }; // XML ID Field const xmlIdField = { displayName: "XML ID", name: "xmlId", type: "string", default: "", description: "External ID for integration", displayOptions: { show: { resource: ["product"], operation: ["add", "update"], }, }, }; // Weight Field const weightField = { displayName: "Weight", name: "weight", type: "number", default: 0, description: "Product weight", displayOptions: { show: { resource: ["product"], operation: ["add", "update"], }, }, }; // Width Field const widthField = { displayName: "Width", name: "width", type: "number", default: 0, description: "Product width", displayOptions: { show: { resource: ["product"], operation: ["add", "update"], }, }, }; // Length Field const lengthField = { displayName: "Length", name: "length", type: "number", default: 0, description: "Product length", displayOptions: { show: { resource: ["product"], operation: ["add", "update"], }, }, }; // Height Field const heightField = { displayName: "Height", name: "height", type: "number", default: 0, description: "Product height", displayOptions: { show: { resource: ["product"], operation: ["add", "update"], }, }, }; // Measure Field const measureField = { displayName: "Measure", name: "measure", type: "string", default: "", description: "Product measure unit", displayOptions: { show: { resource: ["product"], operation: ["add", "update"], }, }, }; // VAT ID Field const vatIdField = { displayName: "VAT ID", name: "vatId", type: "string", default: "", description: "VAT rate ID", displayOptions: { show: { resource: ["product"], operation: ["add", "update"], }, }, }; // VAT Included Field const vatIncludedField = { displayName: "VAT Included", name: "vatIncluded", type: "boolean", default: false, description: "Whether VAT is included in price", displayOptions: { show: { resource: ["product"], operation: ["add", "update"], }, }, }; // Quantity Field const quantityField = { displayName: "Quantity", name: "quantity", type: "number", default: 0, description: "Available quantity", displayOptions: { show: { resource: ["product"], operation: ["add", "update"], }, }, }; // Quantity Trace Field const quantityTraceField = { displayName: "Quantity Trace", name: "quantityTrace", type: "options", options: [ { name: "D", value: "D" }, { name: "Y", value: "Y" }, { name: "N", value: "N" }, ], default: "D", description: "Quantity tracking mode", displayOptions: { show: { resource: ["product"], operation: ["add", "update"], }, }, }; // Can Buy Zero Field const canBuyZeroField = { displayName: "Can Buy Zero", name: "canBuyZero", type: "boolean", default: false, description: "Can buy when quantity is zero", displayOptions: { show: { resource: ["product"], operation: ["add", "update"], }, }, }; // Subscribe Field const subscribeField = { displayName: "Subscribe", name: "subscribe", type: "boolean", default: false, description: "Allow subscription for out-of-stock", displayOptions: { show: { resource: ["product"], operation: ["add", "update"], }, }, }; // Get All operation fields const getAllFields = [ { displayName: "Filter", name: "filter", type: "collection", placeholder: "Add Filter", default: {}, displayOptions: { show: { resource: ["product"], operation: ["getAll"], }, }, options: [ { displayName: "ID", name: "id", type: "string", default: "", description: "Filter by product ID", }, { displayName: "Name", name: "name", type: "string", default: "", description: "Filter by product name", }, { displayName: "Code", name: "code", type: "string", default: "", description: "Filter by product code", }, { displayName: "XML ID", name: "xmlId", type: "string", default: "", description: "Filter by XML ID", }, { displayName: "Active", name: "active", type: "boolean", default: true, description: "Filter by active status", }, { displayName: "Section ID", name: "sectionId", type: "string", default: "", description: "Filter by section ID", }, { displayName: "Catalog ID", name: "catalogId", type: "string", default: "", description: "Filter by catalog ID", }, ], }, { displayName: "Select", name: "select", type: "collection", placeholder: "Add Field", default: {}, displayOptions: { show: { resource: ["product"], operation: ["getAll"], }, }, options: [ { displayName: "Fields", name: "fields", type: "multiOptions", options: [ { name: "ID", value: "ID" }, { name: "Name", value: "NAME" }, { name: "Code", value: "CODE" }, { name: "XML ID", value: "XML_ID" }, { name: "Active", value: "ACTIVE" }, { name: "Sort", value: "SORT" }, { name: "Description", value: "DESCRIPTION" }, { name: "Price", value: "PRICE" }, { name: "Currency", value: "CURRENCY" }, { name: "Weight", value: "WEIGHT" }, { name: "Width", value: "WIDTH" }, { name: "Length", value: "LENGTH" }, { name: "Height", value: "HEIGHT" }, { name: "Measure", value: "MEASURE" }, { name: "VAT ID", value: "VAT_ID" }, { name: "VAT Included", value: "VAT_INCLUDED" }, { name: "Quantity", value: "QUANTITY" }, { name: "Quantity Trace", value: "QUANTITY_TRACE" }, { name: "Can Buy Zero", value: "CAN_BUY_ZERO" }, { name: "Subscribe", value: "SUBSCRIBE" }, { name: "Date Created", value: "DATE_CREATE" }, { name: "Date Modified", value: "DATE_MODIFY" }, { name: "Created By", value: "CREATED_BY" }, { name: "Modified By", value: "MODIFIED_BY" }, ], default: ["ID", "NAME", "PRICE", "CURRENCY"], description: "Fields to return", }, ], }, { displayName: "Order", name: "order", type: "collection", placeholder: "Add Order", default: {}, displayOptions: { show: { resource: ["product"], operation: ["getAll"], }, }, options: [ { displayName: "Field", name: "field", type: "options", options: [ { name: "ID", value: "ID" }, { name: "Name", value: "NAME" }, { name: "Code", value: "CODE" }, { name: "Sort", value: "SORT" }, { name: "Date Created", value: "DATE_CREATE" }, { name: "Date Modified", value: "DATE_MODIFY" }, ], default: "ID", description: "Field to order by", }, { displayName: "Direction", name: "direction", type: "options", options: [ { name: "Ascending", value: "ASC" }, { name: "Descending", value: "DESC" }, ], default: "ASC", description: "Order direction", }, ], }, { displayName: "Limit", name: "limit", type: "number", default: 50, description: "Number of products to return", displayOptions: { show: { resource: ["product"], operation: ["getAll"], }, }, }, ]; // Property ID Field const propertyIdField = { displayName: "Property ID", name: "propertyId", type: "string", required: true, default: "", description: "The ID of the product property", displayOptions: { show: { resource: ["product"], operation: ["getProperty", "updateProperty", "deleteProperty"], }, }, }; // Property Name Field const propertyNameField = { displayName: "Property Name", name: "propertyName", type: "string", required: true, default: "", description: "Name of the product property", displayOptions: { show: { resource: ["product"], operation: ["addProperty", "updateProperty"], }, }, }; // Property Code Field const propertyCodeField = { displayName: "Property Code", name: "propertyCode", type: "string", required: true, default: "", description: "Code of the product property", displayOptions: { show: { resource: ["product"], operation: ["addProperty", "updateProperty"], }, }, }; // Property Type Field const propertyTypeField = { displayName: "Property Type", name: "propertyType", type: "options", options: [ { name: "String", value: "S" }, { name: "Number", value: "N" }, { name: "List", value: "L" }, { name: "File", value: "F" }, { name: "Date", value: "D" }, { name: "DateTime", value: "DT" }, { name: "HTML", value: "HTML" }, { name: "Element", value: "E" }, { name: "Gps", value: "G" }, { name: "User", value: "U" }, ], required: true, default: "S", description: "Type of the product property", displayOptions: { show: { resource: ["product"], operation: ["addProperty", "updateProperty"], }, }, }; // Property Required Field const propertyRequiredField = { displayName: "Property Required", name: "propertyRequired", type: "boolean", default: false, description: "Whether the property is required", displayOptions: { show: { resource: ["product"], operation: ["addProperty", "updateProperty"], }, }, }; // Property Sort Field const propertySortField = { displayName: "Property Sort Order", name: "propertySort", type: "number", default: 100, description: "Sort order of the property", displayOptions: { show: { resource: ["product"], operation: ["addProperty", "updateProperty"], }, }, }; // Property Multiple Field const propertyMultipleField = { displayName: "Property Multiple", name: "propertyMultiple", type: "boolean", default: false, description: "Whether the property can have multiple values", displayOptions: { show: { resource: ["product"], operation: ["addProperty", "updateProperty"], }, }, }; // Property Active Field const propertyActiveField = { displayName: "Property Active", name: "propertyActive", type: "boolean", default: true, description: "Whether the property is active", displayOptions: { show: { resource: ["product"], operation: ["addProperty", "updateProperty"], }, }, }; // Property Values Field const propertyValuesField = { displayName: "Property Values", name: "propertyValues", type: "collection", placeholder: "Add Value", default: {}, description: "Values for list-type properties", displayOptions: { show: { resource: ["product"], operation: ["addProperty", "updateProperty"], }, }, options: [ { displayName: "Values", name: "values", type: "string", typeOptions: { rows: 3, }, default: "", description: "Comma-separated list of values", }, ], }; // Pagination fields const paginationFields = [ { displayName: "Return All", name: "returnAll", type: "boolean", default: false, displayOptions: { show: { resource: ["product"], operation: ["getAll"], }, }, description: "Whether to return all results or only a subset", }, { displayName: "Max Pages to Load", name: "maxPages", type: "number", default: 5, displayOptions: { show: { resource: ["product"], operation: ["getAll"], returnAll: [false], }, }, description: "Maximum number of pages to load (50 items per page)", }, ]; // Export all Product operations and fields exports.productOperations = [ { name: "Get Product", value: "get", description: "Get product information (catalog.product.get)", action: "Get product information", }, { name: "Get Products", value: "getAll", description: "Get list of products (catalog.product.list)", action: "Get list of products", }, { name: "Add Product", value: "add", description: "Add new product (catalog.product.add)", action: "Add new product", }, { name: "Update Product", value: "update", description: "Update product (catalog.product.update)", action: "Update product", }, { name: "Delete Product", value: "delete", description: "Delete product (catalog.product.delete)", action: "Delete product", }, { name: "Get Product Fields", value: "getFields", description: "Get product fields (catalog.product.getFields)", action: "Get product fields", }, { name: "Get Product Property", value: "getProperty", description: "Get product property (catalog.product.property.get)", action: "Get product property", }, { name: "Get Product Properties", value: "getProperties", description: "Get product properties (catalog.product.property.list)", action: "Get product properties", }, { name: "Add Product Property", value: "addProperty", description: "Add product property (catalog.product.property.add)", action: "Add product property", }, { name: "Update Product Property", value: "updateProperty", description: "Update product property (catalog.product.property.update)", action: "Update product property", }, { name: "Delete Product Property", value: "deleteProperty", description: "Delete product property (catalog.product.property.delete)", action: "Delete product property", }, ]; exports.productFields = [ operationField, productIdField, productNameField, priceField, currencyField, catalogIdField, sectionIdField, activeField, sortField, descriptionField, codeField, xmlIdField, weightField, widthField, lengthField, heightField, measureField, vatIdField, vatIncludedField, quantityField, quantityTraceField, canBuyZeroField, subscribeField, propertyIdField, propertyNameField, propertyCodeField, propertyTypeField, propertyRequiredField, propertySortField, propertyMultipleField, propertyActiveField, propertyValuesField, ...getAllFields, ...paginationFields, ]; //# sourceMappingURL=ProductDescription.js.map