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,89 @@
import type {
IDataObject,
IExecuteFunctions,
IHookFunctions,
IHttpRequestMethods,
ILoadOptionsFunctions,
IPollFunctions,
IRequestOptions,
JsonObject,
} from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow';
/**
* Make an API request to Airtable
*
*/
export async function apiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IPollFunctions,
method: IHttpRequestMethods,
endpoint: string,
body: IDataObject,
query?: IDataObject,
uri?: string,
option: IDataObject = {},
): Promise<any> {
const credentials = await this.getCredentials('stackbyApi');
const options: IRequestOptions = {
headers: {
'api-key': credentials.apiKey,
'Content-Type': 'application/json',
},
method,
body,
qs: query,
uri: uri || `https://stackby.com/api/betav1${endpoint}`,
json: true,
};
if (Object.keys(option).length !== 0) {
Object.assign(options, option);
}
if (Object.keys(body).length === 0) {
delete options.body;
}
try {
return await this.helpers.request(options);
} catch (error) {
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
/**
* Make an API request to paginated Airtable endpoint
* and return all results
*
* @param {(IHookFunctions | IExecuteFunctions)} this
*/
export async function apiRequestAllItems(
this: IHookFunctions | IExecuteFunctions | IPollFunctions,
method: IHttpRequestMethods,
endpoint: string,
body: IDataObject = {},
query: IDataObject = {},
) {
query.maxrecord = 100;
query.offset = 0;
const returnData: IDataObject[] = [];
let responseData;
do {
responseData = await apiRequest.call(this, method, endpoint, body, query);
returnData.push.apply(returnData, responseData as IDataObject[]);
query.offset += query.maxrecord;
} while (responseData.length !== 0);
return returnData;
}
export interface IRecord {
field: {
[key: string]: string;
};
}
@@ -0,0 +1,18 @@
{
"node": "n8n-nodes-base.stackby",
"nodeVersion": "1.0",
"codexVersion": "1.0",
"categories": ["Data & Storage"],
"resources": {
"credentialDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/credentials/stackby/"
}
],
"primaryDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.stackby/"
}
]
}
}
@@ -0,0 +1,350 @@
import type {
IExecuteFunctions,
IDataObject,
INodeExecutionData,
INodeType,
INodeTypeDescription,
} from 'n8n-workflow';
import { NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';
import type { IRecord } from './GenericFunction';
import { apiRequest, apiRequestAllItems } from './GenericFunction';
import { generatePairedItemData } from '../../utils/utilities';
export class Stackby implements INodeType {
description: INodeTypeDescription = {
displayName: 'Stackby',
name: 'stackby',
// eslint-disable-next-line n8n-nodes-base/node-class-description-icon-not-svg
icon: 'file:stackby.png',
group: ['transform'],
version: 1,
description: 'Read, write, and delete data in Stackby',
defaults: {
name: 'Stackby',
},
usableAsTool: true,
inputs: [NodeConnectionTypes.Main],
outputs: [NodeConnectionTypes.Main],
credentials: [
{
name: 'stackbyApi',
required: true,
},
],
properties: [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
options: [
{
name: 'Append',
value: 'append',
},
{
name: 'Delete',
value: 'delete',
},
{
name: 'List',
value: 'list',
},
{
name: 'Read',
value: 'read',
},
],
default: 'append',
placeholder: 'Action to perform',
},
// ----------------------------------
// All
// ----------------------------------
{
displayName: 'Stack ID',
name: 'stackId',
type: 'string',
default: '',
required: true,
description: 'The ID of the stack to access',
},
{
displayName: 'Table',
name: 'table',
type: 'string',
default: '',
placeholder: 'Stories',
required: true,
description: 'Enter Table Name',
},
// ----------------------------------
// read
// ----------------------------------
{
displayName: 'ID',
name: 'id',
type: 'string',
displayOptions: {
show: {
operation: ['read', 'delete'],
},
},
default: '',
required: true,
description: 'ID of the record to return',
},
// ----------------------------------
// list
// ----------------------------------
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
operation: ['list'],
},
},
default: true,
description: 'Whether to return all results or only up to a given limit',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
operation: ['list'],
returnAll: [false],
},
},
typeOptions: {
minValue: 1,
maxValue: 1000,
},
default: 1000,
description: 'Max number of results to return',
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
displayOptions: {
show: {
operation: ['list'],
},
},
default: {},
placeholder: 'Add Field',
options: [
{
displayName: 'View',
name: 'view',
type: 'string',
default: '',
placeholder: 'All Stories',
description:
'The name or ID of a view in the Stories table. If set, only the records in that view will be returned. The records will be sorted according to the order of the view.',
},
],
},
// ----------------------------------
// append
// ----------------------------------
{
displayName: 'Columns',
name: 'columns',
type: 'string',
displayOptions: {
show: {
operation: ['append'],
},
},
default: '',
required: true,
placeholder: 'id,name,description',
description:
'Comma-separated list of the properties which should used as columns for the new rows',
},
],
};
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const items = this.getInputData();
const returnData: INodeExecutionData[] = [];
const length = items.length;
let responseData;
const qs: IDataObject = {};
const operation = this.getNodeParameter('operation', 0);
if (operation === 'read') {
for (let i = 0; i < length; i++) {
try {
const stackId = this.getNodeParameter('stackId', i) as string;
const table = encodeURI(this.getNodeParameter('table', i) as string);
const rowIds = this.getNodeParameter('id', i) as string;
qs.rowIds = [rowIds];
responseData = await apiRequest.call(this, 'GET', `/rowlist/${stackId}/${table}`, {}, qs);
returnData.push.apply(
returnData,
responseData.map((data: any) => data.field) as INodeExecutionData[],
);
} catch (error) {
if (this.continueOnFail()) {
const executionErrorData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray({ error: error.message }),
{ itemData: { item: i } },
);
returnData.push(...executionErrorData);
continue;
}
throw error;
}
}
}
if (operation === 'delete') {
for (let i = 0; i < length; i++) {
try {
const stackId = this.getNodeParameter('stackId', i) as string;
const table = encodeURI(this.getNodeParameter('table', i) as string);
const rowIds = this.getNodeParameter('id', i) as string;
qs.rowIds = [rowIds];
responseData = await apiRequest.call(
this,
'DELETE',
`/rowdelete/${stackId}/${table}`,
{},
qs,
);
responseData = responseData.records;
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData as IDataObject),
{ itemData: { item: i } },
);
returnData.push(...executionData);
} catch (error) {
if (this.continueOnFail()) {
const executionErrorData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray({ error: error.message }),
{ itemData: { item: i } },
);
returnData.push(...executionErrorData);
continue;
}
throw error;
}
}
}
if (operation === 'append') {
try {
const records: { [key: string]: IRecord[] } = {};
let key = '';
for (let i = 0; i < length; i++) {
const stackId = this.getNodeParameter('stackId', i) as string;
const table = encodeURI(this.getNodeParameter('table', i) as string);
const columns = this.getNodeParameter('columns', i) as string;
const columnList = columns.split(',').map((column) => column.trim());
const record: { [key: string]: any } = {};
for (const column of columnList) {
if (items[i].json[column] === undefined) {
throw new NodeOperationError(
this.getNode(),
`Column ${column} does not exist on input`,
{ itemIndex: i },
);
} else {
record[column] = items[i].json[column];
}
}
key = `${stackId}/${table}`;
if (records[key] === undefined) {
records[key] = [];
}
records[key].push({ field: record });
}
for (const recordKey of Object.keys(records)) {
responseData = await apiRequest.call(this, 'POST', `/rowcreate/${recordKey}`, {
records: records[recordKey],
});
}
returnData.push.apply(
returnData,
responseData.map((data: any) => data.field) as INodeExecutionData[],
);
} catch (error) {
if (this.continueOnFail()) {
const itemData = generatePairedItemData(items.length);
const executionErrorData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray({ error: error.message }),
{ itemData },
);
returnData.push(...executionErrorData);
} else {
throw error;
}
}
}
if (operation === 'list') {
for (let i = 0; i < length; i++) {
try {
const stackId = this.getNodeParameter('stackId', i) as string;
const table = encodeURI(this.getNodeParameter('table', i) as string);
const returnAll = this.getNodeParameter('returnAll', 0);
const additionalFields = this.getNodeParameter('additionalFields', i, {});
if (additionalFields.view) {
qs.view = additionalFields.view;
}
if (returnAll) {
responseData = await apiRequestAllItems.call(
this,
'GET',
`/rowlist/${stackId}/${table}`,
{},
qs,
);
} else {
qs.maxrecord = this.getNodeParameter('limit', 0);
responseData = await apiRequest.call(
this,
'GET',
`/rowlist/${stackId}/${table}`,
{},
qs,
);
}
returnData.push.apply(
returnData,
responseData.map((data: any) => data.field) as INodeExecutionData[],
);
} catch (error) {
if (this.continueOnFail()) {
const executionErrorData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray({ error: error.message }),
{ itemData: { item: i } },
);
returnData.push(...executionErrorData);
continue;
}
throw error;
}
}
}
return [returnData];
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB