n8n-nodes-netbox
Version:
n8n community node for NetBox API integration with comprehensive DCIM, IPAM, Virtualization, Circuits, Wireless, and data center management operations
1,186 lines (1,185 loc) • 33.7 kB
JavaScript
"use strict";
// descriptions/tenancy.descriptions.ts
Object.defineProperty(exports, "__esModule", { value: true });
exports.tenancyProperties = exports.contactAssignmentFields = exports.contactAssignmentOperations = exports.contactRoleFields = exports.contactRoleOperations = exports.contactGroupFields = exports.contactGroupOperations = exports.contactFields = exports.contactOperations = exports.tenantGroupFields = exports.tenantGroupOperations = exports.tenantFields = exports.tenantOperations = exports.tenancyResources = void 0;
const baseProperties_1 = require("./baseProperties");
// Resource options for tenancy domain
exports.tenancyResources = [
{
name: 'Tenants',
value: 'tenants',
description: 'Manage tenants',
},
{
name: 'Tenant Groups',
value: 'tenantGroups',
description: 'Manage tenant groups',
},
{
name: 'Contacts',
value: 'contacts',
description: 'Manage contacts',
},
{
name: 'Contact Roles',
value: 'contactRoles',
description: 'Manage contact roles',
},
{
name: 'Contact Groups',
value: 'contactGroups',
description: 'Manage contact groups',
},
{
name: 'Contact Assignments',
value: 'contactAssignments',
description: 'Manage contact assignments',
},
];
// Removed global commonListOperationFields - each resource defines its own Return All field with proper domain/resource restrictions
const commonIDField = {
displayName: 'ID',
name: 'id',
type: 'string',
required: true,
default: '',
description: 'ID of the record',
displayOptions: {
show: {
domain: ['tenancy'],
operation: ['get', 'update', 'delete'],
},
},
};
// =============================================================================
// TENANT OPERATIONS AND FIELDS
// =============================================================================
exports.tenantOperations = {
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
default: 'list',
required: true,
options: [
{
name: 'List',
value: 'list',
action: 'List tenants',
description: 'Get all tenants',
},
{
name: 'Get',
value: 'get',
action: 'Get a tenant',
description: 'Get tenant by ID',
},
{
name: 'Create',
value: 'create',
action: 'Create a tenant',
description: 'Create a new tenant',
},
{
name: 'Update',
value: 'update',
action: 'Update a tenant',
description: 'Update an existing tenant',
},
{
name: 'Delete',
value: 'delete',
action: 'Delete a tenant',
description: 'Delete a tenant',
},
],
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['tenants'],
},
},
};
exports.tenantFields = [
commonIDField,
// Return All option for list operation
{
...baseProperties_1.returnAllOption,
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['tenants'],
operation: ['list'],
},
},
},
// Limit option for list operation
{
...baseProperties_1.limitOption,
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['tenants'],
operation: ['list'],
returnAll: [false],
},
},
},
{
displayName: 'Name',
name: 'tenantName',
type: 'string',
default: '',
required: true,
description: 'Name of the tenant',
noDataExpression: false,
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['tenants'],
operation: ['create', 'update'],
},
},
},
{
displayName: 'Slug',
name: 'slug',
type: 'string',
default: '',
required: true,
description: 'Slug of the tenant',
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['tenants'],
operation: ['create', 'update'],
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['tenants'],
operation: ['create', 'update'],
},
},
options: [
{
displayName: 'Description',
name: 'tenantDescription',
type: 'string',
default: '',
description: 'Description of the tenant',
noDataExpression: false,
},
{
displayName: 'Group ID',
name: 'group',
type: 'number',
default: null,
description: 'ID of the parent tenant group',
},
{
displayName: 'Tags',
name: 'tags',
type: 'string',
default: '',
description: 'Tags to apply to this tenant (comma-separated)',
},
{
displayName: 'Comments',
name: 'comments',
type: 'string',
default: '',
description: 'Comments about the tenant',
},
],
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Filter',
default: {},
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['tenants'],
operation: ['list'],
},
},
options: [
{
displayName: 'Name',
name: 'tenantName',
type: 'string',
default: '',
description: 'Filter by tenant name (exact match)',
noDataExpression: false,
},
{
displayName: 'Name (Contains)',
name: 'name__ic',
type: 'string',
default: '',
description: 'Filter by tenant names containing this value (case-insensitive)',
noDataExpression: false,
},
{
displayName: 'Slug',
name: 'slug',
type: 'string',
default: '',
description: 'Filter by tenant slug',
},
{
displayName: 'Group',
name: 'group',
type: 'string',
default: '',
description: 'Filter by tenant group name or slug (comma-separated for multiple)',
},
{
displayName: 'Group ID',
name: 'group_id',
type: 'string',
default: '',
description: 'Filter by tenant group ID (comma-separated for multiple)',
},
{
displayName: 'Tag',
name: 'tag',
type: 'string',
default: '',
description: 'Filter by tag (comma-separated for multiple)',
},
{
displayName: 'Search Query',
name: 'q',
type: 'string',
default: '',
description: 'Search for tenants matching this query',
},
],
},
];
// =============================================================================
// TENANT GROUP OPERATIONS AND FIELDS
// =============================================================================
exports.tenantGroupOperations = {
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
default: 'list',
required: true,
options: [
{
name: 'List',
value: 'list',
action: 'List tenant groups',
description: 'Get all tenant groups',
},
{
name: 'Get',
value: 'get',
action: 'Get a tenant group',
description: 'Get tenant group by ID',
},
{
name: 'Create',
value: 'create',
action: 'Create a tenant group',
description: 'Create a new tenant group',
},
{
name: 'Update',
value: 'update',
action: 'Update a tenant group',
description: 'Update an existing tenant group',
},
{
name: 'Delete',
value: 'delete',
action: 'Delete a tenant group',
description: 'Delete a tenant group',
},
],
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['tenantGroups'],
},
},
};
exports.tenantGroupFields = [
commonIDField,
// Return All option for list operation
{
...baseProperties_1.returnAllOption,
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['tenantGroups'],
operation: ['list'],
},
},
},
// Limit option for list operation
{
...baseProperties_1.limitOption,
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['tenantGroups'],
operation: ['list'],
returnAll: [false],
},
},
},
{
displayName: 'Name',
name: 'tenantGroupName',
type: 'string',
default: '',
required: true,
description: 'Name of the tenant group',
noDataExpression: false,
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['tenantGroups'],
operation: ['create', 'update'],
},
},
},
{
displayName: 'Slug',
name: 'slug',
type: 'string',
default: '',
required: true,
description: 'Slug of the tenant group',
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['tenantGroups'],
operation: ['create', 'update'],
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['tenantGroups'],
operation: ['create', 'update'],
},
},
options: [
{
displayName: 'Parent Group ID',
name: 'parent',
type: 'number',
default: null,
description: 'ID of the parent tenant group',
},
{
displayName: 'Description',
name: 'tenantGroupDescription',
type: 'string',
default: '',
description: 'Description of the tenant group',
noDataExpression: false,
},
],
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Filter',
default: {},
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['tenantGroups'],
operation: ['list'],
},
},
options: [
{
displayName: 'Name',
name: 'tenantGroupName',
type: 'string',
default: '',
description: 'Filter by tenant group name',
noDataExpression: false,
},
{
displayName: 'Parent ID',
name: 'parent_id',
type: 'number',
default: null,
description: 'Filter by parent tenant group ID',
},
],
},
];
// =============================================================================
// CONTACT OPERATIONS AND FIELDS
// =============================================================================
exports.contactOperations = {
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
default: 'list',
required: true,
options: [
{
name: 'List',
value: 'list',
action: 'List contacts',
description: 'Get all contacts',
},
{
name: 'Get',
value: 'get',
action: 'Get a contact',
description: 'Get contact by ID',
},
{
name: 'Create',
value: 'create',
action: 'Create a contact',
description: 'Create a new contact',
},
{
name: 'Update',
value: 'update',
action: 'Update a contact',
description: 'Update an existing contact',
},
{
name: 'Delete',
value: 'delete',
action: 'Delete a contact',
description: 'Delete a contact',
},
],
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['contacts'],
},
},
};
exports.contactFields = [
commonIDField,
// Return All option for list operation
{
...baseProperties_1.returnAllOption,
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['contacts'],
operation: ['list'],
},
},
},
// Limit option for list operation
{
...baseProperties_1.limitOption,
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['contacts'],
operation: ['list'],
returnAll: [false],
},
},
},
{
displayName: 'Name',
name: 'contactName',
type: 'string',
default: '',
required: true,
description: 'Name of the contact',
noDataExpression: false,
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['contacts'],
operation: ['create', 'update'],
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['contacts'],
operation: ['create', 'update'],
},
},
options: [
{
displayName: 'Title',
name: 'title',
type: 'string',
default: '',
description: 'Title of the contact',
},
{
displayName: 'Phone',
name: 'phone',
type: 'string',
default: '',
description: 'Phone number of the contact',
},
{
displayName: 'Email',
name: 'email',
type: 'string',
default: '',
description: 'Email address of the contact',
},
{
displayName: 'Address',
name: 'address',
type: 'string',
default: '',
description: 'Address of the contact',
},
{
displayName: 'Link',
name: 'link',
type: 'string',
default: '',
description: 'Link associated with the contact',
},
{
displayName: 'Group ID',
name: 'group',
type: 'number',
default: null,
description: 'ID of the contact group',
},
{
displayName: 'Tags',
name: 'tags',
type: 'string',
default: '',
description: 'Tags to apply to this contact (comma-separated)',
},
{
displayName: 'Comments',
name: 'comments',
type: 'string',
default: '',
description: 'Comments about the contact',
},
],
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Filter',
default: {},
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['contacts'],
operation: ['list'],
},
},
options: [
{
displayName: 'Name',
name: 'contactName',
type: 'string',
default: '',
description: 'Filter by contact name',
noDataExpression: false,
},
{
displayName: 'Email',
name: 'email',
type: 'string',
default: '',
description: 'Filter by email address',
},
{
displayName: 'Group ID',
name: 'group_id',
type: 'number',
default: null,
description: 'Filter by contact group ID',
},
],
},
];
// =============================================================================
// CONTACT GROUP OPERATIONS AND FIELDS
// =============================================================================
exports.contactGroupOperations = {
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
default: 'list',
required: true,
options: [
{
name: 'List',
value: 'list',
action: 'List contact groups',
description: 'Get all contact groups',
},
{
name: 'Get',
value: 'get',
action: 'Get a contact group',
description: 'Get contact group by ID',
},
{
name: 'Create',
value: 'create',
action: 'Create a contact group',
description: 'Create a new contact group',
},
{
name: 'Update',
value: 'update',
action: 'Update a contact group',
description: 'Update an existing contact group',
},
{
name: 'Delete',
value: 'delete',
action: 'Delete a contact group',
description: 'Delete a contact group',
},
],
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['contactGroups'],
},
},
};
exports.contactGroupFields = [
commonIDField,
// Return All option for list operation
{
...baseProperties_1.returnAllOption,
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['contactGroups'],
operation: ['list'],
},
},
},
// Limit option for list operation
{
...baseProperties_1.limitOption,
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['contactGroups'],
operation: ['list'],
returnAll: [false],
},
},
},
{
displayName: 'Name',
name: 'contactGroupName',
type: 'string',
default: '',
required: true,
description: 'Name of the contact group',
noDataExpression: false,
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['contactGroups'],
operation: ['create', 'update'],
},
},
},
{
displayName: 'Slug',
name: 'slug',
type: 'string',
default: '',
required: true,
description: 'Slug of the contact group',
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['contactGroups'],
operation: ['create', 'update'],
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['contactGroups'],
operation: ['create', 'update'],
},
},
options: [
{
displayName: 'Parent Group ID',
name: 'parent',
type: 'number',
default: null,
description: 'ID of the parent contact group',
},
{
displayName: 'Description',
name: 'contactGroupDescription',
type: 'string',
default: '',
description: 'Description of the contact group',
noDataExpression: false,
},
],
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Filter',
default: {},
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['contactGroups'],
operation: ['list'],
},
},
options: [
{
displayName: 'Name',
name: 'contactGroupName',
type: 'string',
default: '',
description: 'Filter by contact group name',
noDataExpression: false,
},
{
displayName: 'Parent ID',
name: 'parent_id',
type: 'number',
default: null,
description: 'Filter by parent contact group ID',
},
],
},
];
// =============================================================================
// CONTACT ROLE OPERATIONS AND FIELDS
// =============================================================================
exports.contactRoleOperations = {
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
default: 'list',
required: true,
options: [
{
name: 'List',
value: 'list',
action: 'List contact roles',
description: 'Get all contact roles',
},
{
name: 'Get',
value: 'get',
action: 'Get a contact role',
description: 'Get contact role by ID',
},
{
name: 'Create',
value: 'create',
action: 'Create a contact role',
description: 'Create a new contact role',
},
{
name: 'Update',
value: 'update',
action: 'Update a contact role',
description: 'Update an existing contact role',
},
{
name: 'Delete',
value: 'delete',
action: 'Delete a contact role',
description: 'Delete a contact role',
},
],
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['contactRoles'],
},
},
};
exports.contactRoleFields = [
commonIDField,
// Return All option for list operation
{
...baseProperties_1.returnAllOption,
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['contactRoles'],
operation: ['list'],
},
},
},
// Limit option for list operation
{
...baseProperties_1.limitOption,
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['contactRoles'],
operation: ['list'],
returnAll: [false],
},
},
},
{
displayName: 'Name',
name: 'contactRoleName',
type: 'string',
default: '',
required: true,
description: 'Name of the contact role',
noDataExpression: false,
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['contactRoles'],
operation: ['create', 'update'],
},
},
},
{
displayName: 'Slug',
name: 'slug',
type: 'string',
default: '',
required: true,
description: 'Slug of the contact role',
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['contactRoles'],
operation: ['create', 'update'],
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['contactRoles'],
operation: ['create', 'update'],
},
},
options: [
{
displayName: 'Description',
name: 'contactRoleDescription',
type: 'string',
default: '',
description: 'Description of the contact role',
noDataExpression: false,
},
],
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Filter',
default: {},
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['contactRoles'],
operation: ['list'],
},
},
options: [
{
displayName: 'Name',
name: 'contactRoleName',
type: 'string',
default: '',
description: 'Filter by contact role name',
noDataExpression: false,
},
],
},
];
// =============================================================================
// CONTACT ASSIGNMENT OPERATIONS AND FIELDS
// =============================================================================
exports.contactAssignmentOperations = {
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
default: 'list',
required: true,
options: [
{
name: 'List',
value: 'list',
action: 'List contact assignments',
description: 'Get all contact assignments',
},
{
name: 'Get',
value: 'get',
action: 'Get a contact assignment',
description: 'Get contact assignment by ID',
},
{
name: 'Create',
value: 'create',
action: 'Create a contact assignment',
description: 'Create a new contact assignment',
},
{
name: 'Update',
value: 'update',
action: 'Update a contact assignment',
description: 'Update an existing contact assignment',
},
{
name: 'Delete',
value: 'delete',
action: 'Delete a contact assignment',
description: 'Delete a contact assignment',
},
],
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['contactAssignments'],
},
},
};
exports.contactAssignmentFields = [
commonIDField,
// Return All option for list operation
{
...baseProperties_1.returnAllOption,
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['contactAssignments'],
operation: ['list'],
},
},
},
// Limit option for list operation
{
...baseProperties_1.limitOption,
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['contactAssignments'],
operation: ['list'],
returnAll: [false],
},
},
},
{
displayName: 'Object Type',
name: 'object_type',
type: 'string',
default: '',
required: true,
description: 'Content type of the assigned object',
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['contactAssignments'],
operation: ['create', 'update'],
},
},
},
{
displayName: 'Object ID',
name: 'object_id',
type: 'number',
default: 0,
required: true,
description: 'ID of the assigned object',
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['contactAssignments'],
operation: ['create', 'update'],
},
},
},
{
displayName: 'Contact ID',
name: 'contact',
type: 'number',
default: 0,
required: true,
description: 'ID of the contact',
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['contactAssignments'],
operation: ['create', 'update'],
},
},
},
{
displayName: 'Role ID',
name: 'role',
type: 'number',
default: 0,
required: true,
description: 'ID of the contact role',
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['contactAssignments'],
operation: ['create', 'update'],
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['contactAssignments'],
operation: ['create', 'update'],
},
},
options: [
{
displayName: 'Priority',
name: 'priority',
type: 'options',
options: [
{ name: 'Primary', value: 'primary' },
{ name: 'Secondary', value: 'secondary' },
{ name: 'Tertiary', value: 'tertiary' },
{ name: 'Inactive', value: 'inactive' },
],
default: 'primary',
description: 'Priority of the contact assignment',
},
],
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Filter',
default: {},
displayOptions: {
show: {
domain: ['tenancy'],
resource: ['contactAssignments'],
operation: ['list'],
},
},
options: [
{
displayName: 'Object Type',
name: 'object_type',
type: 'string',
default: '',
description: 'Filter by object type',
},
{
displayName: 'Object ID',
name: 'object_id',
type: 'number',
default: null,
description: 'Filter by object ID',
},
{
displayName: 'Contact ID',
name: 'contact_id',
type: 'number',
default: null,
description: 'Filter by contact ID',
},
{
displayName: 'Role ID',
name: 'role_id',
type: 'number',
default: null,
description: 'Filter by contact role ID',
},
],
},
];
// Export all properties together
exports.tenancyProperties = [
exports.tenantOperations,
...exports.tenantFields,
exports.tenantGroupOperations,
...exports.tenantGroupFields,
exports.contactOperations,
...exports.contactFields,
exports.contactGroupOperations,
...exports.contactGroupFields,
exports.contactRoleOperations,
...exports.contactRoleFields,
exports.contactAssignmentOperations,
...exports.contactAssignmentFields,
];