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:
@@ -0,0 +1,161 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const untilFolderSelected = { folder: [''] };
|
||||
|
||||
export const untilItemSelected = { item: [''] };
|
||||
|
||||
export const untilListSelected = { list: [''] };
|
||||
|
||||
export const untilSiteSelected = { site: [''] };
|
||||
|
||||
export const fileRLC: INodeProperties = {
|
||||
displayName: 'File',
|
||||
name: 'file',
|
||||
default: {
|
||||
mode: 'list',
|
||||
value: '',
|
||||
},
|
||||
description: 'Select the file to download',
|
||||
modes: [
|
||||
{
|
||||
displayName: 'From List',
|
||||
name: 'list',
|
||||
type: 'list',
|
||||
typeOptions: {
|
||||
searchListMethod: 'getFiles',
|
||||
searchable: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'By ID',
|
||||
name: 'id',
|
||||
placeholder: 'e.g. mysite',
|
||||
type: 'string',
|
||||
},
|
||||
],
|
||||
placeholder: 'eg. my-file.pdf',
|
||||
required: true,
|
||||
type: 'resourceLocator',
|
||||
};
|
||||
|
||||
export const folderRLC: INodeProperties = {
|
||||
displayName: 'Parent Folder',
|
||||
name: 'folder',
|
||||
default: {
|
||||
mode: 'list',
|
||||
value: '',
|
||||
},
|
||||
description: 'Select the folder to update the file in',
|
||||
modes: [
|
||||
{
|
||||
displayName: 'From List',
|
||||
name: 'list',
|
||||
type: 'list',
|
||||
typeOptions: {
|
||||
searchListMethod: 'getFolders',
|
||||
searchable: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'By ID',
|
||||
name: 'id',
|
||||
placeholder: 'e.g. myfolder',
|
||||
type: 'string',
|
||||
},
|
||||
],
|
||||
placeholder: '/ (Library root)',
|
||||
required: true,
|
||||
type: 'resourceLocator',
|
||||
};
|
||||
|
||||
export const itemRLC: INodeProperties = {
|
||||
displayName: 'Item',
|
||||
name: 'item',
|
||||
default: {
|
||||
mode: 'list',
|
||||
value: '',
|
||||
},
|
||||
description: 'Select the item you want to delete',
|
||||
modes: [
|
||||
{
|
||||
displayName: 'From List',
|
||||
name: 'list',
|
||||
type: 'list',
|
||||
typeOptions: {
|
||||
searchListMethod: 'getItems',
|
||||
searchable: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'By ID',
|
||||
name: 'id',
|
||||
placeholder: 'e.g. 1',
|
||||
type: 'string',
|
||||
},
|
||||
],
|
||||
required: true,
|
||||
type: 'resourceLocator',
|
||||
};
|
||||
|
||||
export const listRLC: INodeProperties = {
|
||||
displayName: 'List',
|
||||
name: 'list',
|
||||
default: {
|
||||
mode: 'list',
|
||||
value: '',
|
||||
},
|
||||
description: 'Select the list you want to retrieve',
|
||||
modes: [
|
||||
{
|
||||
displayName: 'From List',
|
||||
name: 'list',
|
||||
type: 'list',
|
||||
typeOptions: {
|
||||
searchListMethod: 'getLists',
|
||||
searchable: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'By ID',
|
||||
name: 'id',
|
||||
placeholder: 'e.g. mylist',
|
||||
type: 'string',
|
||||
},
|
||||
],
|
||||
required: true,
|
||||
type: 'resourceLocator',
|
||||
};
|
||||
|
||||
export const siteRLC: INodeProperties = {
|
||||
displayName: 'Site',
|
||||
name: 'site',
|
||||
default: {
|
||||
mode: 'list',
|
||||
value: '',
|
||||
},
|
||||
description: 'Select the site to retrieve folders from',
|
||||
modes: [
|
||||
{
|
||||
displayName: 'From List',
|
||||
name: 'list',
|
||||
type: 'list',
|
||||
typeOptions: {
|
||||
searchListMethod: 'getSites',
|
||||
searchable: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'By ID',
|
||||
name: 'id',
|
||||
placeholder: 'e.g. mysite',
|
||||
type: 'string',
|
||||
},
|
||||
],
|
||||
required: true,
|
||||
type: 'resourceLocator',
|
||||
};
|
||||
|
||||
export const ignoreHttpStatusErrorsConfig = {
|
||||
ignore: true as const,
|
||||
except: [401],
|
||||
};
|
||||
@@ -0,0 +1,74 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import * as download from './download.operation';
|
||||
import * as update from './update.operation';
|
||||
import * as upload from './upload.operation';
|
||||
import { downloadFilePostReceive, handleErrorPostReceive } from '../../helpers/utils';
|
||||
|
||||
export const description: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['file'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Download',
|
||||
value: 'download',
|
||||
description: 'Download a file',
|
||||
routing: {
|
||||
request: {
|
||||
method: 'GET',
|
||||
url: '=/sites/{{ $parameter["site"] }}/drive/items/{{ $parameter["file"] }}/content',
|
||||
json: false,
|
||||
encoding: 'arraybuffer',
|
||||
},
|
||||
output: {
|
||||
postReceive: [handleErrorPostReceive, downloadFilePostReceive],
|
||||
},
|
||||
},
|
||||
action: 'Download file',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update a file',
|
||||
routing: {
|
||||
request: {
|
||||
method: 'PATCH',
|
||||
url: '=/sites/{{ $parameter["site"] }}/drive/items/{{ $parameter["file"] }}',
|
||||
},
|
||||
output: {
|
||||
postReceive: [handleErrorPostReceive],
|
||||
},
|
||||
},
|
||||
action: 'Update file',
|
||||
},
|
||||
{
|
||||
name: 'Upload',
|
||||
value: 'upload',
|
||||
description: 'Upload an existing file',
|
||||
routing: {
|
||||
request: {
|
||||
method: 'PUT',
|
||||
url: '=/sites/{{ $parameter["site"] }}/drive/items/{{ $parameter["folder"] }}:/{{ $parameter["fileName"] }}:/content',
|
||||
},
|
||||
output: {
|
||||
postReceive: [handleErrorPostReceive],
|
||||
},
|
||||
},
|
||||
action: 'Upload file',
|
||||
},
|
||||
],
|
||||
default: 'download',
|
||||
},
|
||||
|
||||
...download.description,
|
||||
...update.description,
|
||||
...upload.description,
|
||||
];
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
import { updateDisplayOptions, type INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
fileRLC,
|
||||
folderRLC,
|
||||
siteRLC,
|
||||
untilFolderSelected,
|
||||
untilSiteSelected,
|
||||
} from '../common.descriptions';
|
||||
|
||||
const properties: INodeProperties[] = [
|
||||
{
|
||||
...siteRLC,
|
||||
description: 'Select the site to retrieve folders from',
|
||||
},
|
||||
{
|
||||
...folderRLC,
|
||||
description: 'Select the folder to download the file from',
|
||||
displayOptions: {
|
||||
hide: {
|
||||
...untilSiteSelected,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
...fileRLC,
|
||||
description: 'Select the file to download',
|
||||
displayOptions: {
|
||||
hide: {
|
||||
...untilSiteSelected,
|
||||
...untilFolderSelected,
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['file'],
|
||||
operation: ['download'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
@@ -0,0 +1,122 @@
|
||||
import {
|
||||
updateDisplayOptions,
|
||||
type IExecuteSingleFunctions,
|
||||
type IN8nHttpFullResponse,
|
||||
type INodeExecutionData,
|
||||
type INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { microsoftSharePointApiRequest } from '../../transport';
|
||||
import {
|
||||
fileRLC,
|
||||
folderRLC,
|
||||
siteRLC,
|
||||
untilFolderSelected,
|
||||
untilSiteSelected,
|
||||
} from '../common.descriptions';
|
||||
|
||||
const properties: INodeProperties[] = [
|
||||
{
|
||||
...siteRLC,
|
||||
description: 'Select the site to retrieve folders from',
|
||||
},
|
||||
{
|
||||
...folderRLC,
|
||||
description: 'Select the folder to update the file in',
|
||||
displayOptions: {
|
||||
hide: {
|
||||
...untilSiteSelected,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
...fileRLC,
|
||||
description: 'Select the file to update',
|
||||
displayOptions: {
|
||||
hide: {
|
||||
...untilSiteSelected,
|
||||
...untilFolderSelected,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Updated File Name',
|
||||
name: 'fileName',
|
||||
default: '',
|
||||
description: 'If not specified, the original file name will be used',
|
||||
placeholder: 'e.g. My New File',
|
||||
routing: {
|
||||
send: {
|
||||
property: 'name',
|
||||
type: 'body',
|
||||
value: '={{ $value }}',
|
||||
},
|
||||
},
|
||||
type: 'string',
|
||||
},
|
||||
{
|
||||
displayName: 'Change File Content',
|
||||
name: 'changeFileContent',
|
||||
default: false,
|
||||
description: 'Whether to update the file contents',
|
||||
placeholder: 'e.g. My New File',
|
||||
required: true,
|
||||
type: 'boolean',
|
||||
},
|
||||
{
|
||||
displayName: 'Updated File Contents',
|
||||
name: 'fileContents',
|
||||
default: '',
|
||||
description:
|
||||
'Find the name of input field containing the binary data to update the file with in the Input panel on the left, in the Binary tab',
|
||||
displayOptions: {
|
||||
show: {
|
||||
changeFileContent: [true],
|
||||
},
|
||||
},
|
||||
hint: 'The name of the input field containing the binary file data to update the file with',
|
||||
placeholder: 'data',
|
||||
required: true,
|
||||
routing: {
|
||||
output: {
|
||||
postReceive: [
|
||||
async function (
|
||||
this: IExecuteSingleFunctions,
|
||||
items: INodeExecutionData[],
|
||||
_response: IN8nHttpFullResponse,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
for (const item of items) {
|
||||
const site = this.getNodeParameter('site', undefined, {
|
||||
extractValue: true,
|
||||
}) as string;
|
||||
const file = this.getNodeParameter('file', undefined, {
|
||||
extractValue: true,
|
||||
}) as string;
|
||||
const binaryProperty = this.getNodeParameter('fileContents') as string;
|
||||
this.helpers.assertBinaryData(binaryProperty);
|
||||
const binaryDataBuffer = await this.helpers.getBinaryDataBuffer(binaryProperty);
|
||||
const response = await microsoftSharePointApiRequest.call(
|
||||
this,
|
||||
'PUT',
|
||||
`/sites/${site}/drive/items/${file}/content`,
|
||||
binaryDataBuffer,
|
||||
);
|
||||
item.json = response;
|
||||
}
|
||||
return items;
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
type: 'string',
|
||||
},
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['file'],
|
||||
operation: ['update'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
@@ -0,0 +1,54 @@
|
||||
import { updateDisplayOptions, type INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { uploadFilePreSend } from '../../helpers/utils';
|
||||
import { folderRLC, siteRLC, untilSiteSelected } from '../common.descriptions';
|
||||
|
||||
const properties: INodeProperties[] = [
|
||||
{
|
||||
...siteRLC,
|
||||
description: 'Select the site to retrieve folders from',
|
||||
},
|
||||
{
|
||||
...folderRLC,
|
||||
description: 'Select the folder to upload the file to',
|
||||
displayOptions: {
|
||||
hide: {
|
||||
...untilSiteSelected,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'File Name',
|
||||
name: 'fileName',
|
||||
default: '',
|
||||
description: 'The name of the file being uploaded',
|
||||
placeholder: 'e.g. My New File',
|
||||
required: true,
|
||||
type: 'string',
|
||||
},
|
||||
{
|
||||
displayName: 'File Contents',
|
||||
name: 'fileContents',
|
||||
default: '',
|
||||
description:
|
||||
'Find the name of input field containing the binary data to upload in the Input panel on the left, in the Binary tab',
|
||||
hint: 'The name of the input field containing the binary file data to upload',
|
||||
placeholder: 'data',
|
||||
required: true,
|
||||
routing: {
|
||||
send: {
|
||||
preSend: [uploadFilePreSend],
|
||||
},
|
||||
},
|
||||
type: 'string',
|
||||
},
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['file'],
|
||||
operation: ['upload'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
@@ -0,0 +1,3 @@
|
||||
export * as file from './file/File.resource';
|
||||
export * as item from './item/Item.resource';
|
||||
export * as list from './list/List.resource';
|
||||
@@ -0,0 +1,142 @@
|
||||
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 * as update from './update.operation';
|
||||
import * as upsert from './upsert.operation';
|
||||
import { handleErrorPostReceive, simplifyItemPostReceive } from '../../helpers/utils';
|
||||
import { ignoreHttpStatusErrorsConfig } from '../common.descriptions';
|
||||
|
||||
export const description: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['item'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create an item in an existing list',
|
||||
routing: {
|
||||
request: {
|
||||
method: 'POST',
|
||||
url: '=/sites/{{ $parameter["site"] }}/lists/{{ $parameter["list"] }}/items',
|
||||
},
|
||||
output: {
|
||||
postReceive: [handleErrorPostReceive],
|
||||
},
|
||||
},
|
||||
action: 'Create item in a list',
|
||||
},
|
||||
{
|
||||
name: 'Create or Update',
|
||||
value: 'upsert',
|
||||
description: 'Create a new item, or update the current one if it already exists (upsert)',
|
||||
routing: {
|
||||
request: {
|
||||
method: 'POST',
|
||||
url: '=/sites/{{ $parameter["site"] }}/lists/{{ $parameter["list"] }}/items',
|
||||
},
|
||||
output: {
|
||||
postReceive: [handleErrorPostReceive],
|
||||
},
|
||||
},
|
||||
action: 'Create or update item (upsert)',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete an item from a list',
|
||||
routing: {
|
||||
request: {
|
||||
method: 'DELETE',
|
||||
url: '=/sites/{{ $parameter["site"] }}/lists/{{ $parameter["list"] }}/items/{{ $parameter["item"] }}',
|
||||
},
|
||||
output: {
|
||||
postReceive: [
|
||||
handleErrorPostReceive,
|
||||
{
|
||||
type: 'set',
|
||||
properties: {
|
||||
value: '={{ { "deleted": true } }}',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
action: 'Delete an item',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Retrieve an item from a list',
|
||||
routing: {
|
||||
request: {
|
||||
ignoreHttpStatusErrors: ignoreHttpStatusErrorsConfig,
|
||||
method: 'GET',
|
||||
url: '=/sites/{{ $parameter["site"] }}/lists/{{ $parameter["list"] }}/items/{{ $parameter["item"] }}',
|
||||
},
|
||||
output: {
|
||||
postReceive: [handleErrorPostReceive, simplifyItemPostReceive],
|
||||
},
|
||||
},
|
||||
action: 'Get an item',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Get specific items in a list or list many items',
|
||||
routing: {
|
||||
request: {
|
||||
method: 'GET',
|
||||
url: '=/sites/{{ $parameter["site"] }}/lists/{{ $parameter["list"] }}/items',
|
||||
},
|
||||
output: {
|
||||
postReceive: [
|
||||
handleErrorPostReceive,
|
||||
{
|
||||
type: 'rootProperty',
|
||||
properties: {
|
||||
property: 'value',
|
||||
},
|
||||
},
|
||||
simplifyItemPostReceive,
|
||||
],
|
||||
},
|
||||
},
|
||||
action: 'Get many items',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update an item in an existing list',
|
||||
routing: {
|
||||
request: {
|
||||
method: 'PATCH',
|
||||
url: '=/sites/{{ $parameter["site"] }}/lists/{{ $parameter["list"] }}/items',
|
||||
},
|
||||
output: {
|
||||
postReceive: [handleErrorPostReceive],
|
||||
},
|
||||
},
|
||||
action: 'Update item in a list',
|
||||
},
|
||||
],
|
||||
default: 'getAll',
|
||||
},
|
||||
|
||||
...create.description,
|
||||
...del.description,
|
||||
...get.description,
|
||||
...getAll.description,
|
||||
...update.description,
|
||||
...upsert.description,
|
||||
];
|
||||
@@ -0,0 +1,77 @@
|
||||
import { updateDisplayOptions, type INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { itemColumnsPreSend } from '../../helpers/utils';
|
||||
import { listRLC, siteRLC, untilListSelected, untilSiteSelected } from '../common.descriptions';
|
||||
|
||||
const properties: INodeProperties[] = [
|
||||
{
|
||||
...siteRLC,
|
||||
description: 'Select the site to retrieve lists from',
|
||||
},
|
||||
{
|
||||
...listRLC,
|
||||
description: 'Select the list you want to create an item in',
|
||||
displayOptions: {
|
||||
hide: {
|
||||
...untilSiteSelected,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName:
|
||||
'Due to API restrictions, the following column types cannot be updated: Hyperlink, Location, Metadata',
|
||||
name: 'noticeUnsupportedFields',
|
||||
displayOptions: {
|
||||
hide: {
|
||||
...untilSiteSelected,
|
||||
...untilListSelected,
|
||||
},
|
||||
},
|
||||
type: 'notice',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Columns',
|
||||
name: 'columns',
|
||||
default: {
|
||||
mappingMode: 'defineBelow',
|
||||
value: null,
|
||||
},
|
||||
displayOptions: {
|
||||
hide: {
|
||||
...untilSiteSelected,
|
||||
...untilListSelected,
|
||||
},
|
||||
},
|
||||
noDataExpression: true,
|
||||
required: true,
|
||||
routing: {
|
||||
send: {
|
||||
preSend: [itemColumnsPreSend],
|
||||
},
|
||||
},
|
||||
type: 'resourceMapper',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['site.value', 'list.value'],
|
||||
resourceMapper: {
|
||||
resourceMapperMethod: 'getMappingColumns',
|
||||
mode: 'add',
|
||||
fieldWords: {
|
||||
singular: 'column',
|
||||
plural: 'columns',
|
||||
},
|
||||
addAllFields: true,
|
||||
multiKeyMatch: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['item'],
|
||||
operation: ['create'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
@@ -0,0 +1,44 @@
|
||||
import { updateDisplayOptions, type INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
itemRLC,
|
||||
listRLC,
|
||||
siteRLC,
|
||||
untilListSelected,
|
||||
untilSiteSelected,
|
||||
} from '../common.descriptions';
|
||||
|
||||
const properties: INodeProperties[] = [
|
||||
{
|
||||
...siteRLC,
|
||||
description: 'Select the site to retrieve lists from',
|
||||
},
|
||||
{
|
||||
...listRLC,
|
||||
description: 'Select the list you want to delete an item in',
|
||||
displayOptions: {
|
||||
hide: {
|
||||
...untilSiteSelected,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
...itemRLC,
|
||||
description: 'Select the item you want to delete',
|
||||
displayOptions: {
|
||||
hide: {
|
||||
...untilSiteSelected,
|
||||
...untilListSelected,
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['item'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
@@ -0,0 +1,69 @@
|
||||
import type { IExecuteSingleFunctions, IHttpRequestOptions, INodeProperties } from 'n8n-workflow';
|
||||
import { updateDisplayOptions } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
itemRLC,
|
||||
listRLC,
|
||||
siteRLC,
|
||||
untilListSelected,
|
||||
untilSiteSelected,
|
||||
} from '../common.descriptions';
|
||||
|
||||
const properties: INodeProperties[] = [
|
||||
{
|
||||
...siteRLC,
|
||||
description: 'Select the site to retrieve lists from',
|
||||
},
|
||||
{
|
||||
...listRLC,
|
||||
description: 'Select the list you want to retrieve an item from',
|
||||
displayOptions: {
|
||||
hide: {
|
||||
...untilSiteSelected,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
...itemRLC,
|
||||
description: 'Select the item you want to get',
|
||||
displayOptions: {
|
||||
hide: {
|
||||
...untilSiteSelected,
|
||||
...untilListSelected,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Simplify',
|
||||
name: 'simplify',
|
||||
default: true,
|
||||
routing: {
|
||||
send: {
|
||||
preSend: [
|
||||
async function (
|
||||
this: IExecuteSingleFunctions,
|
||||
requestOptions: IHttpRequestOptions,
|
||||
): Promise<IHttpRequestOptions> {
|
||||
const simplify = this.getNodeParameter('simplify', false) as boolean;
|
||||
if (simplify) {
|
||||
requestOptions.qs ??= {};
|
||||
requestOptions.qs.$select = 'id,createdDateTime,lastModifiedDateTime,webUrl';
|
||||
requestOptions.qs.$expand = 'fields(select=Title)';
|
||||
}
|
||||
return requestOptions;
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
type: 'boolean',
|
||||
},
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['item'],
|
||||
operation: ['get'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
@@ -0,0 +1,186 @@
|
||||
import type { IExecuteSingleFunctions, IHttpRequestOptions, INodeProperties } from 'n8n-workflow';
|
||||
import { updateDisplayOptions } from 'n8n-workflow';
|
||||
|
||||
import { itemGetAllFieldsPreSend } from '../../helpers/utils';
|
||||
import { listRLC, siteRLC, untilSiteSelected } from '../common.descriptions';
|
||||
|
||||
const properties: INodeProperties[] = [
|
||||
{
|
||||
...siteRLC,
|
||||
description: 'Select the site to retrieve lists from',
|
||||
},
|
||||
{
|
||||
...listRLC,
|
||||
description: 'Select the list you want to search for items in',
|
||||
displayOptions: {
|
||||
hide: {
|
||||
...untilSiteSelected,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Filter by Formula',
|
||||
name: 'filter',
|
||||
default: '',
|
||||
description:
|
||||
'The formula will be evaluated for each record. <a href="https://learn.microsoft.com/en-us/graph/filter-query-parameter">More info</a>.',
|
||||
hint: 'If empty, all the items will be returned',
|
||||
placeholder: "e.g. fields/Title eq 'item1'",
|
||||
routing: {
|
||||
send: {
|
||||
property: '$filter',
|
||||
type: 'query',
|
||||
value: '={{ $value ? $value : undefined }}',
|
||||
},
|
||||
},
|
||||
type: 'string',
|
||||
},
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
default: false,
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
routing: {
|
||||
send: {
|
||||
paginate: '={{ $value }}',
|
||||
},
|
||||
operations: {
|
||||
pagination: {
|
||||
type: 'generic',
|
||||
properties: {
|
||||
continue: '={{ !!$response.body?.["@odata.nextLink"] }}',
|
||||
request: {
|
||||
url: '={{ $response.body?.["@odata.nextLink"] ?? $request.url }}',
|
||||
qs: {
|
||||
$select:
|
||||
'={{ !!$response.body?.["@odata.nextLink"] ? undefined : $request.qs?.$select }}',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
type: 'boolean',
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
displayOptions: {
|
||||
show: {
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
routing: {
|
||||
send: {
|
||||
property: '$top',
|
||||
type: 'query',
|
||||
value: '={{ $value }}',
|
||||
},
|
||||
},
|
||||
type: 'number',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
validateType: 'number',
|
||||
},
|
||||
{
|
||||
displayName: 'Options',
|
||||
name: 'options',
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Fields',
|
||||
name: 'fields',
|
||||
default: [],
|
||||
description: 'The fields you want to include in the output',
|
||||
displayOptions: {
|
||||
hide: {
|
||||
'/simplify': [true],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Content Type',
|
||||
value: 'contentType',
|
||||
},
|
||||
{
|
||||
name: 'Created At',
|
||||
value: 'createdDateTime',
|
||||
},
|
||||
{
|
||||
name: 'Created By',
|
||||
value: 'createdBy',
|
||||
},
|
||||
{
|
||||
name: 'Fields',
|
||||
value: 'fields',
|
||||
},
|
||||
{
|
||||
name: 'ID',
|
||||
value: 'id',
|
||||
},
|
||||
{
|
||||
name: 'Last Modified At',
|
||||
value: 'lastModifiedDateTime',
|
||||
},
|
||||
{
|
||||
name: 'Last Modified By',
|
||||
value: 'lastModifiedBy',
|
||||
},
|
||||
|
||||
{
|
||||
name: 'Parent Reference',
|
||||
value: 'parentReference',
|
||||
},
|
||||
{
|
||||
name: 'Web URL',
|
||||
value: 'webUrl',
|
||||
},
|
||||
],
|
||||
routing: {
|
||||
send: {
|
||||
preSend: [itemGetAllFieldsPreSend],
|
||||
},
|
||||
},
|
||||
type: 'multiOptions',
|
||||
},
|
||||
],
|
||||
placeholder: 'Add option',
|
||||
type: 'collection',
|
||||
},
|
||||
{
|
||||
displayName: 'Simplify',
|
||||
name: 'simplify',
|
||||
default: true,
|
||||
routing: {
|
||||
send: {
|
||||
preSend: [
|
||||
async function (
|
||||
this: IExecuteSingleFunctions,
|
||||
requestOptions: IHttpRequestOptions,
|
||||
): Promise<IHttpRequestOptions> {
|
||||
const simplify = this.getNodeParameter('simplify', false) as boolean;
|
||||
if (simplify) {
|
||||
requestOptions.qs ??= {};
|
||||
requestOptions.qs.$select = 'id,createdDateTime,lastModifiedDateTime,webUrl';
|
||||
requestOptions.qs.$expand = 'fields(select=Title)';
|
||||
}
|
||||
return requestOptions;
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
type: 'boolean',
|
||||
},
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['item'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
@@ -0,0 +1,77 @@
|
||||
import { updateDisplayOptions, type INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { itemColumnsPreSend } from '../../helpers/utils';
|
||||
import { listRLC, siteRLC, untilListSelected, untilSiteSelected } from '../common.descriptions';
|
||||
|
||||
const properties: INodeProperties[] = [
|
||||
{
|
||||
...siteRLC,
|
||||
description: 'Select the site to retrieve lists from',
|
||||
},
|
||||
{
|
||||
...listRLC,
|
||||
description: 'Select the list you want to update an item in',
|
||||
displayOptions: {
|
||||
hide: {
|
||||
...untilSiteSelected,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName:
|
||||
'Due to API restrictions, the following column types cannot be updated: Hyperlink, Location, Metadata',
|
||||
name: 'noticeUnsupportedFields',
|
||||
displayOptions: {
|
||||
hide: {
|
||||
...untilSiteSelected,
|
||||
...untilListSelected,
|
||||
},
|
||||
},
|
||||
type: 'notice',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Columns',
|
||||
name: 'columns',
|
||||
default: {
|
||||
mappingMode: 'defineBelow',
|
||||
value: null,
|
||||
},
|
||||
displayOptions: {
|
||||
hide: {
|
||||
...untilSiteSelected,
|
||||
...untilListSelected,
|
||||
},
|
||||
},
|
||||
noDataExpression: true,
|
||||
required: true,
|
||||
routing: {
|
||||
send: {
|
||||
preSend: [itemColumnsPreSend],
|
||||
},
|
||||
},
|
||||
type: 'resourceMapper',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['site.value', 'list.value'],
|
||||
resourceMapper: {
|
||||
resourceMapperMethod: 'getMappingColumns',
|
||||
mode: 'update',
|
||||
fieldWords: {
|
||||
singular: 'column',
|
||||
plural: 'columns',
|
||||
},
|
||||
addAllFields: true,
|
||||
multiKeyMatch: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['item'],
|
||||
operation: ['update'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
@@ -0,0 +1,77 @@
|
||||
import { updateDisplayOptions, type INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { itemColumnsPreSend } from '../../helpers/utils';
|
||||
import { listRLC, siteRLC, untilListSelected, untilSiteSelected } from '../common.descriptions';
|
||||
|
||||
const properties: INodeProperties[] = [
|
||||
{
|
||||
...siteRLC,
|
||||
description: 'Select the site to retrieve lists from',
|
||||
},
|
||||
{
|
||||
...listRLC,
|
||||
description: 'Select the list you want to create or update an item in',
|
||||
displayOptions: {
|
||||
hide: {
|
||||
...untilSiteSelected,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName:
|
||||
'Due to API restrictions, the following column types cannot be updated: Hyperlink, Location, Metadata',
|
||||
name: 'noticeUnsupportedFields',
|
||||
displayOptions: {
|
||||
hide: {
|
||||
...untilSiteSelected,
|
||||
...untilListSelected,
|
||||
},
|
||||
},
|
||||
type: 'notice',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Columns',
|
||||
name: 'columns',
|
||||
default: {
|
||||
mappingMode: 'defineBelow',
|
||||
value: null,
|
||||
},
|
||||
displayOptions: {
|
||||
hide: {
|
||||
...untilSiteSelected,
|
||||
...untilListSelected,
|
||||
},
|
||||
},
|
||||
noDataExpression: true,
|
||||
required: true,
|
||||
routing: {
|
||||
send: {
|
||||
preSend: [itemColumnsPreSend],
|
||||
},
|
||||
},
|
||||
type: 'resourceMapper',
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['site.value', 'list.value'],
|
||||
resourceMapper: {
|
||||
resourceMapperMethod: 'getMappingColumns',
|
||||
mode: 'upsert',
|
||||
fieldWords: {
|
||||
singular: 'column',
|
||||
plural: 'columns',
|
||||
},
|
||||
addAllFields: true,
|
||||
multiKeyMatch: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['item'],
|
||||
operation: ['upsert'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
@@ -0,0 +1,66 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import * as get from './get.operation';
|
||||
import * as getAll from './getAll.operation';
|
||||
import { handleErrorPostReceive, simplifyListPostReceive } from '../../helpers/utils';
|
||||
import { ignoreHttpStatusErrorsConfig } from '../common.descriptions';
|
||||
|
||||
export const description: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['list'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Retrieve details of a single list',
|
||||
routing: {
|
||||
request: {
|
||||
ignoreHttpStatusErrors: ignoreHttpStatusErrorsConfig,
|
||||
method: 'GET',
|
||||
url: '=/sites/{{ $parameter["site"] }}/lists/{{ $parameter["list"] }}',
|
||||
},
|
||||
output: {
|
||||
postReceive: [handleErrorPostReceive, simplifyListPostReceive],
|
||||
},
|
||||
},
|
||||
action: 'Get list',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Retrieve a list of lists',
|
||||
routing: {
|
||||
request: {
|
||||
method: 'GET',
|
||||
url: '=/sites/{{ $parameter["site"] }}/lists',
|
||||
},
|
||||
output: {
|
||||
postReceive: [
|
||||
handleErrorPostReceive,
|
||||
{
|
||||
type: 'rootProperty',
|
||||
properties: {
|
||||
property: 'value',
|
||||
},
|
||||
},
|
||||
simplifyListPostReceive,
|
||||
],
|
||||
},
|
||||
},
|
||||
action: 'Get many lists',
|
||||
},
|
||||
],
|
||||
default: 'getAll',
|
||||
},
|
||||
|
||||
...get.description,
|
||||
...getAll.description,
|
||||
];
|
||||
@@ -0,0 +1,42 @@
|
||||
import { updateDisplayOptions, type INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { listRLC, siteRLC, untilSiteSelected } from '../common.descriptions';
|
||||
|
||||
const properties: INodeProperties[] = [
|
||||
{
|
||||
...siteRLC,
|
||||
description: 'Select the site to retrieve lists from',
|
||||
},
|
||||
{
|
||||
...listRLC,
|
||||
description: 'Select the list you want to retrieve',
|
||||
displayOptions: {
|
||||
hide: {
|
||||
...untilSiteSelected,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Simplify',
|
||||
name: 'simplify',
|
||||
default: true,
|
||||
routing: {
|
||||
send: {
|
||||
property: '$select',
|
||||
type: 'query',
|
||||
value:
|
||||
'={{ $value ? "id,name,displayName,description,createdDateTime,lastModifiedDateTime,webUrl" : undefined }}',
|
||||
},
|
||||
},
|
||||
type: 'boolean',
|
||||
},
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['list'],
|
||||
operation: ['get'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
@@ -0,0 +1,83 @@
|
||||
import { updateDisplayOptions, type INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { siteRLC } from '../common.descriptions';
|
||||
|
||||
const properties: INodeProperties[] = [
|
||||
{
|
||||
...siteRLC,
|
||||
description: 'Select the site to retrieve lists from',
|
||||
},
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
default: false,
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
routing: {
|
||||
send: {
|
||||
paginate: '={{ $value }}',
|
||||
},
|
||||
operations: {
|
||||
pagination: {
|
||||
type: 'generic',
|
||||
properties: {
|
||||
continue: '={{ !!$response.body?.["@odata.nextLink"] }}',
|
||||
request: {
|
||||
url: '={{ $response.body?.["@odata.nextLink"] ?? $request.url }}',
|
||||
qs: {
|
||||
$select:
|
||||
'={{ !!$response.body?.["@odata.nextLink"] ? undefined : $request.qs?.$select }}',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
type: 'boolean',
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
displayOptions: {
|
||||
show: {
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
routing: {
|
||||
send: {
|
||||
property: '$top',
|
||||
type: 'query',
|
||||
value: '={{ $value }}',
|
||||
},
|
||||
},
|
||||
type: 'number',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
validateType: 'number',
|
||||
},
|
||||
{
|
||||
displayName: 'Simplify',
|
||||
name: 'simplify',
|
||||
default: true,
|
||||
routing: {
|
||||
send: {
|
||||
property: '$select',
|
||||
type: 'query',
|
||||
value:
|
||||
'={{ $value ? "id,name,displayName,description,createdDateTime,lastModifiedDateTime,webUrl" : undefined }}',
|
||||
},
|
||||
},
|
||||
type: 'boolean',
|
||||
},
|
||||
];
|
||||
|
||||
const displayOptions = {
|
||||
show: {
|
||||
resource: ['list'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
};
|
||||
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
Reference in New Issue
Block a user