Files
n8n-enterprise-unlocked/packages/nodes-base/nodes/Microsoft/AzureCosmosDb/descriptions/container/Container.resource.ts
AdinaTotorean b52f9f0f6c feat(Azure Cosmos DB Node): New node (#14156)
Co-authored-by: feelgood-interface <feelgood.interface@gmail.com>
2025-04-09 15:05:33 +01:00

108 lines
2.1 KiB
TypeScript

import type { INodeProperties } from 'n8n-workflow';
import * as create from './create.operation';
import * as del from './delete.operation';
import * as get from './get.operation';
import * as getAll from './getAll.operation';
import { handleError } from '../../helpers/errorHandler';
import { simplifyData } from '../../helpers/utils';
export const description: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['container'],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create a container',
routing: {
request: {
method: 'POST',
url: '/colls',
},
output: {
postReceive: [handleError],
},
},
action: 'Create container',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a container',
routing: {
request: {
method: 'DELETE',
url: '=/colls/{{ $parameter["container"] }}',
},
output: {
postReceive: [
handleError,
{
type: 'set',
properties: {
value: '={{ { "deleted": true } }}',
},
},
],
},
},
action: 'Delete container',
},
{
name: 'Get',
value: 'get',
description: 'Retrieve a container',
routing: {
request: {
method: 'GET',
url: '=/colls/{{ $parameter["container"] }}',
},
output: {
postReceive: [handleError, simplifyData],
},
},
action: 'Get container',
},
{
name: 'Get Many',
value: 'getAll',
description: 'Retrieve a list of containers',
routing: {
request: {
method: 'GET',
url: '/colls',
},
output: {
postReceive: [
handleError,
{
type: 'rootProperty',
properties: {
property: 'DocumentCollections',
},
},
simplifyData,
],
},
},
action: 'Get many containers',
},
],
default: 'getAll',
},
...create.description,
...del.description,
...get.description,
...getAll.description,
];