first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
+107
@@ -0,0 +1,107 @@
|
||||
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,
|
||||
];
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteSingleFunctions,
|
||||
IHttpRequestOptions,
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { OperationalError, updateDisplayOptions } from 'n8n-workflow';
|
||||
|
||||
import { HeaderConstants } from '../../helpers/constants';
|
||||
import { processJsonInput } from '../../helpers/utils';
|
||||
|
||||
const properties: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'ID',
|
||||
name: 'containerCreate',
|
||||
default: '',
|
||||
description: 'Unique identifier for the new container',
|
||||
placeholder: 'e.g. Container1',
|
||||
required: true,
|
||||
routing: {
|
||||
send: {
|
||||
preSend: [
|
||||
async function (
|
||||
this: IExecuteSingleFunctions,
|
||||
requestOptions: IHttpRequestOptions,
|
||||
): Promise<IHttpRequestOptions> {
|
||||
const id = this.getNodeParameter('containerCreate') as string;
|
||||
|
||||
if (/\s/.test(id)) {
|
||||
throw new OperationalError('The container ID must not contain spaces.');
|
||||
}
|
||||
|
||||
if (!/^[a-zA-Z0-9-_]+$/.test(id)) {
|
||||
throw new OperationalError(
|
||||
'The container ID may only contain letters, numbers, hyphens, and underscores.',
|
||||
);
|
||||
}
|
||||
|
||||
(requestOptions.body as IDataObject).id = id;
|
||||
|
||||
return requestOptions;
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
type: 'string',
|
||||
},
|
||||
{
|
||||
displayName: 'Partition Key',
|
||||
name: 'partitionKey',
|
||||
default: '{\n\t"paths": [\n\t\t"/id"\n\t],\n\t"kind": "Hash",\n\t"version": 2\n}',
|
||||
description:
|
||||
'The partition key is used to automatically distribute data across partitions for scalability. Choose a property in your JSON document that has a wide range of values and evenly distributes request volume.',
|
||||
required: true,
|
||||
routing: {
|
||||
send: {
|
||||
preSend: [
|
||||
async function (
|
||||
this: IExecuteSingleFunctions,
|
||||
requestOptions: IHttpRequestOptions,
|
||||
): Promise<IHttpRequestOptions> {
|
||||
const rawPartitionKey = this.getNodeParameter('partitionKey') as IDataObject;
|
||||
const partitionKey = processJsonInput(rawPartitionKey, 'Partition Key', {
|
||||
paths: ['/id'],
|
||||
kind: 'Hash',
|
||||
version: 2,
|
||||
});
|
||||
(requestOptions.body as IDataObject).partitionKey = partitionKey;
|
||||
return requestOptions;
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
type: 'json',
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Indexing Policy',
|
||||
name: 'indexingPolicy',
|
||||
default:
|
||||
'{\n\t"indexingMode": "consistent",\n\t"automatic": true,\n\t"includedPaths": [\n\t\t{\n\t\t\t"path": "/*"\n\t\t}\n\t],\n\t"excludedPaths": []\n}',
|
||||
description: 'This value is used to configure indexing policy',
|
||||
routing: {
|
||||
send: {
|
||||
preSend: [
|
||||
async function (
|
||||
this: IExecuteSingleFunctions,
|
||||
requestOptions: IHttpRequestOptions,
|
||||
): Promise<IHttpRequestOptions> {
|
||||
const rawIndexingPolicy = this.getNodeParameter(
|
||||
'additionalFields.indexingPolicy',
|
||||
) as IDataObject;
|
||||
const indexPolicy = processJsonInput(rawIndexingPolicy, 'Indexing Policy');
|
||||
(requestOptions.body as IDataObject).indexingPolicy = indexPolicy;
|
||||
return requestOptions;
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
type: 'json',
|
||||
},
|
||||
{
|
||||
displayName: 'Max RU/s (for Autoscale)',
|
||||
name: 'maxThroughput',
|
||||
default: 1000,
|
||||
description: 'The user specified autoscale max RU/s',
|
||||
displayOptions: {
|
||||
hide: {
|
||||
'/additionalFields.offerThroughput': [{ _cnd: { exists: true } }],
|
||||
},
|
||||
},
|
||||
routing: {
|
||||
request: {
|
||||
headers: {
|
||||
[HeaderConstants.X_MS_COSMOS_OFFER_AUTOPILOT_SETTING]: '={{ $value }}',
|
||||
},
|
||||
},
|
||||
},
|
||||
type: 'number',
|
||||
typeOptions: {
|
||||
minValue: 1000,
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Manual Throughput RU/s',
|
||||
name: 'offerThroughput',
|
||||
default: 400,
|
||||
description:
|
||||
'The user specified manual throughput (RU/s) for the collection expressed in units of 100 request units per second',
|
||||
displayOptions: {
|
||||
hide: {
|
||||
'/additionalFields.maxThroughput': [{ _cnd: { exists: true } }],
|
||||
},
|
||||
},
|
||||
routing: {
|
||||
request: {
|
||||
headers: {
|
||||
[HeaderConstants.X_MS_OFFER_THROUGHPUT]: '={{ $value }}',
|
||||
},
|
||||
},
|
||||
},
|
||||
type: 'number',
|
||||
typeOptions: {
|
||||
minValue: 400,
|
||||
},
|
||||
},
|
||||
],
|
||||
placeholder: 'Add Option',
|
||||
type: 'collection',
|
||||
},
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['container'],
|
||||
operation: ['create'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
import { updateDisplayOptions, type INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { containerResourceLocator } from '../common';
|
||||
|
||||
const properties: INodeProperties[] = [
|
||||
{ ...containerResourceLocator, description: 'Select the container you want to delete' },
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['container'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
import { updateDisplayOptions, type INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { containerResourceLocator } from '../common';
|
||||
|
||||
const properties: INodeProperties[] = [
|
||||
{ ...containerResourceLocator, description: 'Select the container you want to retrieve' },
|
||||
{
|
||||
displayName: 'Simplify',
|
||||
name: 'simple',
|
||||
default: true,
|
||||
description: 'Whether to return a simplified version of the response instead of the raw data',
|
||||
type: 'boolean',
|
||||
},
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['container'],
|
||||
operation: ['get'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
import { updateDisplayOptions, type INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { paginationParameters } from '../common';
|
||||
|
||||
const properties: INodeProperties[] = [
|
||||
...paginationParameters,
|
||||
{
|
||||
displayName: 'Simplify',
|
||||
name: 'simple',
|
||||
default: true,
|
||||
description: 'Whether to return a simplified version of the response instead of the raw data',
|
||||
type: 'boolean',
|
||||
},
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['container'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
Reference in New Issue
Block a user