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

This commit is contained in:
2026-03-17 16:22:57 +03:30
commit 3d5eaf9445
15349 changed files with 2847338 additions and 0 deletions
@@ -0,0 +1,37 @@
import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
import { updateDisplayOptions } from 'n8n-workflow';
import { apiRequest } from '../../transport';
export const properties: INodeProperties[] = [
{
displayName: 'File ID',
name: 'fileId',
type: 'string',
placeholder: 'e.g. file_123',
description: 'ID of the file to delete',
default: '',
},
];
const displayOptions = {
show: {
operation: ['deleteFile'],
resource: ['file'],
},
};
export const description = updateDisplayOptions(displayOptions, properties);
export async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {
const fileId = this.getNodeParameter('fileId', i, '') as string;
const response = (await apiRequest.call(this, 'DELETE', `/v1/files/${fileId}`)) as {
id: string;
};
return [
{
json: response,
pairedItem: { item: i },
},
];
}
@@ -0,0 +1,38 @@
import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
import { updateDisplayOptions } from 'n8n-workflow';
import type { File } from '../../helpers/interfaces';
import { getBaseUrl } from '../../helpers/utils';
import { apiRequest } from '../../transport';
export const properties: INodeProperties[] = [
{
displayName: 'File ID',
name: 'fileId',
type: 'string',
placeholder: 'e.g. file_123',
description: 'ID of the file to get metadata for',
default: '',
},
];
const displayOptions = {
show: {
operation: ['get'],
resource: ['file'],
},
};
export const description = updateDisplayOptions(displayOptions, properties);
export async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {
const fileId = this.getNodeParameter('fileId', i, '') as string;
const baseUrl = await getBaseUrl.call(this);
const response = (await apiRequest.call(this, 'GET', `/v1/files/${fileId}`)) as File;
return [
{
json: { ...response, url: `${baseUrl}/v1/files/${response.id}` },
pairedItem: { item: i },
},
];
}
@@ -0,0 +1,53 @@
import type { INodeProperties } from 'n8n-workflow';
import * as deleteFile from './delete.operation';
import * as get from './get.operation';
import * as list from './list.operation';
import * as upload from './upload.operation';
export { deleteFile, get, list, upload };
export const description: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
options: [
{
name: 'Upload File',
value: 'upload',
action: 'Upload a file',
description: 'Upload a file to the Anthropic API for later use',
},
{
name: 'Get File Metadata',
value: 'get',
action: 'Get file metadata',
description: 'Get metadata for a file from the Anthropic API',
},
{
name: 'List Files',
value: 'list',
action: 'List files',
description: 'List files from the Anthropic API',
},
{
name: 'Delete File',
value: 'deleteFile',
action: 'Delete a file',
description: 'Delete a file from the Anthropic API',
},
],
default: 'upload',
displayOptions: {
show: {
resource: ['file'],
},
},
},
...deleteFile.description,
...get.description,
...list.description,
...upload.description,
];
@@ -0,0 +1,95 @@
import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
import { updateDisplayOptions } from 'n8n-workflow';
import type { File } from '../../helpers/interfaces';
import { getBaseUrl } from '../../helpers/utils';
import { apiRequest } from '../../transport';
interface FileListResponse {
data: File[];
first_id: string;
last_id: string;
has_more: boolean;
}
export const properties: INodeProperties[] = [
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
default: false,
description: 'Whether to return all results or only up to a given limit',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
typeOptions: {
minValue: 1,
maxValue: 1000,
},
default: 50,
description: 'Max number of results to return',
displayOptions: {
show: {
returnAll: [false],
},
},
},
];
const displayOptions = {
show: {
operation: ['list'],
resource: ['file'],
},
};
export const description = updateDisplayOptions(displayOptions, properties);
export async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {
const returnAll = this.getNodeParameter('returnAll', i, false);
const limit = this.getNodeParameter('limit', i, 50);
const baseUrl = await getBaseUrl.call(this);
if (returnAll) {
return await getAllFiles.call(this, baseUrl, i);
} else {
return await getFiles.call(this, baseUrl, i, limit);
}
}
async function getAllFiles(this: IExecuteFunctions, baseUrl: string, i: number) {
let hasMore = true;
let lastId: string | undefined = undefined;
const files: File[] = [];
while (hasMore) {
const response = (await apiRequest.call(this, 'GET', '/v1/files', {
qs: {
limit: 1000,
after_id: lastId,
},
})) as FileListResponse;
hasMore = response.has_more;
lastId = response.last_id;
files.push(...response.data);
}
return files.map((file) => ({
json: { ...file, url: `${baseUrl}/v1/files/${file.id}` },
pairedItem: { item: i },
}));
}
async function getFiles(this: IExecuteFunctions, baseUrl: string, i: number, limit: number) {
const response = (await apiRequest.call(this, 'GET', '/v1/files', {
qs: {
limit,
},
})) as FileListResponse;
return response.data.map((file) => ({
json: { ...file, url: `${baseUrl}/v1/files/${file.id}` },
pairedItem: { item: i },
}));
}
@@ -0,0 +1,103 @@
import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
import { updateDisplayOptions } from 'n8n-workflow';
import type { File } from '../../helpers/interfaces';
import { downloadFile, getBaseUrl, uploadFile } from '../../helpers/utils';
export const properties: INodeProperties[] = [
{
displayName: 'Input Type',
name: 'inputType',
type: 'options',
default: 'url',
options: [
{
name: 'File URL',
value: 'url',
},
{
name: 'Binary File',
value: 'binary',
},
],
},
{
displayName: 'URL',
name: 'fileUrl',
type: 'string',
placeholder: 'e.g. https://example.com/file.pdf',
description: 'URL of the file to upload',
default: '',
displayOptions: {
show: {
inputType: ['url'],
},
},
},
{
displayName: 'Input Data Field Name',
name: 'binaryPropertyName',
type: 'string',
default: 'data',
placeholder: 'e.g. data',
hint: 'The name of the input field containing the binary file data to be processed',
description: 'Name of the binary field which contains the file',
displayOptions: {
show: {
inputType: ['binary'],
},
},
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
options: [
{
displayName: 'File Name',
name: 'fileName',
type: 'string',
description: 'The file name to use for the uploaded file',
default: '',
},
],
},
];
const displayOptions = {
show: {
operation: ['upload'],
resource: ['file'],
},
};
export const description = updateDisplayOptions(displayOptions, properties);
export async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {
const inputType = this.getNodeParameter('inputType', i, 'url') as string;
const fileName = this.getNodeParameter('options.fileName', i, 'file') as string;
const baseUrl = await getBaseUrl.call(this);
let response: File;
if (inputType === 'url') {
const fileUrl = this.getNodeParameter('fileUrl', i, '') as string;
const { fileContent, mimeType } = await downloadFile.call(this, fileUrl);
response = await uploadFile.call(this, fileContent, mimeType, fileName);
} else {
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i, 'data');
const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
const buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
response = await uploadFile.call(this, buffer, binaryData.mimeType, fileName);
}
return [
{
json: { ...response, url: `${baseUrl}/v1/files/${response.id}` },
pairedItem: {
item: i,
},
},
];
}