mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
run lintfix
This commit is contained in:
parent
4f41decdda
commit
0184e65904
|
@ -2,9 +2,12 @@ import type { ICredentialTestRequest, ICredentialType, INodeProperties } from 'n
|
||||||
|
|
||||||
export class SeaTableApi implements ICredentialType {
|
export class SeaTableApi implements ICredentialType {
|
||||||
name = 'seaTableApi';
|
name = 'seaTableApi';
|
||||||
|
|
||||||
displayName = 'SeaTable API';
|
displayName = 'SeaTable API';
|
||||||
|
|
||||||
documentationUrl =
|
documentationUrl =
|
||||||
'https://seatable.io/docs/n8n-integration/erstellen-eines-api-tokens-fuer-n8n/?lang=auto';
|
'https://seatable.io/docs/n8n-integration/erstellen-eines-api-tokens-fuer-n8n/?lang=auto';
|
||||||
|
|
||||||
properties: INodeProperties[] = [
|
properties: INodeProperties[] = [
|
||||||
{
|
{
|
||||||
displayName: 'Environment',
|
displayName: 'Environment',
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable n8n-nodes-base/node-filename-against-convention */
|
||||||
import type { INodeTypeDescription } from 'n8n-workflow';
|
import type { INodeTypeDescription } from 'n8n-workflow';
|
||||||
import { rowFields, rowOperations } from './RowDescription';
|
import { rowFields, rowOperations } from './RowDescription';
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@ export type TSeaTableServerEdition = 'enterprise edition';
|
||||||
// dtable
|
// dtable
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
|
|
||||||
import type { IDtableMetadataColumn, IDtableMetadataTable, TDtableViewColumn } from './Interfaces';
|
|
||||||
import type { ICredentialDataDecryptedObject } from 'n8n-workflow';
|
import type { ICredentialDataDecryptedObject } from 'n8n-workflow';
|
||||||
|
import type { IDtableMetadataColumn, IDtableMetadataTable, TDtableViewColumn } from './Interfaces';
|
||||||
|
|
||||||
export type TInheritColumnTypeTime = 'ctime' | 'mtime';
|
export type TInheritColumnTypeTime = 'ctime' | 'mtime';
|
||||||
export type TInheritColumnTypeUser = 'creator' | 'last-modifier';
|
export type TInheritColumnTypeUser = 'creator' | 'last-modifier';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import FormData from 'form-data';
|
import type FormData from 'form-data';
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
IDataObject,
|
IDataObject,
|
||||||
|
@ -11,6 +11,7 @@ import type {
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { NodeApiError } from 'n8n-workflow';
|
import { NodeApiError } from 'n8n-workflow';
|
||||||
|
|
||||||
|
import moment from 'moment';
|
||||||
import type { TDtableMetadataColumns, TEndpointVariableName } from './types';
|
import type { TDtableMetadataColumns, TEndpointVariableName } from './types';
|
||||||
|
|
||||||
import { schema } from './Schema';
|
import { schema } from './Schema';
|
||||||
|
@ -29,8 +30,6 @@ import type {
|
||||||
IFile,
|
IFile,
|
||||||
} from './actions/Interfaces';
|
} from './actions/Interfaces';
|
||||||
|
|
||||||
import moment from 'moment';
|
|
||||||
|
|
||||||
// remove last backslash
|
// remove last backslash
|
||||||
const userBaseUri = (uri?: string) => {
|
const userBaseUri = (uri?: string) => {
|
||||||
if (uri === undefined) return uri;
|
if (uri === undefined) return uri;
|
||||||
|
@ -135,7 +134,7 @@ export async function seaTableApiRequest(
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return this.helpers.requestWithAuthentication.call(this, 'seaTableApi', options);
|
return await this.helpers.requestWithAuthentication.call(this, 'seaTableApi', options);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new NodeApiError(this.getNode(), error as JsonObject);
|
throw new NodeApiError(this.getNode(), error as JsonObject);
|
||||||
}
|
}
|
||||||
|
@ -144,13 +143,13 @@ export async function seaTableApiRequest(
|
||||||
export async function getBaseCollaborators(
|
export async function getBaseCollaborators(
|
||||||
this: ILoadOptionsFunctions | IExecuteFunctions | IPollFunctions,
|
this: ILoadOptionsFunctions | IExecuteFunctions | IPollFunctions,
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
let collaboratorsResult: ICollaboratorsResult = await seaTableApiRequest.call(
|
const collaboratorsResult: ICollaboratorsResult = await seaTableApiRequest.call(
|
||||||
this,
|
this,
|
||||||
{},
|
{},
|
||||||
'GET',
|
'GET',
|
||||||
'/dtable-server/api/v1/dtables/{{dtable_uuid}}/related-users/',
|
'/dtable-server/api/v1/dtables/{{dtable_uuid}}/related-users/',
|
||||||
);
|
);
|
||||||
let collaborators: ICollaborator[] = collaboratorsResult.user_list || [];
|
const collaborators: ICollaborator[] = collaboratorsResult.user_list || [];
|
||||||
return collaborators;
|
return collaborators;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,7 +187,6 @@ export const nameOfPredicate = (names: readonly IName[]) => (name: string) =>
|
||||||
|
|
||||||
const normalize = (subject: string): string => (subject ? subject.normalize() : '');
|
const normalize = (subject: string): string => (subject ? subject.normalize() : '');
|
||||||
|
|
||||||
/* will ich diesen call ? */
|
|
||||||
export const split = (subject: string): string[] =>
|
export const split = (subject: string): string[] =>
|
||||||
normalize(subject)
|
normalize(subject)
|
||||||
.split(/\s*((?:[^\\,]*?(?:\\[\s\S])*)*?)\s*(?:,|$)/)
|
.split(/\s*((?:[^\\,]*?(?:\\[\s\S])*)*?)\s*(?:,|$)/)
|
||||||
|
@ -199,12 +197,14 @@ export const split = (subject: string): string[] =>
|
||||||
function getCollaboratorInfo(
|
function getCollaboratorInfo(
|
||||||
authLocal: string | null | undefined,
|
authLocal: string | null | undefined,
|
||||||
collaboratorList: ICollaborator[],
|
collaboratorList: ICollaborator[],
|
||||||
) {
|
): ICollaborator {
|
||||||
let collaboratorDetails: ICollaborator;
|
return (
|
||||||
collaboratorDetails = collaboratorList.find(
|
collaboratorList.find((singleCollaborator) => singleCollaborator.email === authLocal) || {
|
||||||
(singleCollaborator) => singleCollaborator['email'] === authLocal,
|
contact_email: 'unknown',
|
||||||
) || { contact_email: 'unknown', name: 'unkown', email: 'unknown' };
|
name: 'unkown',
|
||||||
return collaboratorDetails;
|
email: 'unknown',
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// INTERNAL: split asset path.
|
// INTERNAL: split asset path.
|
||||||
|
@ -222,18 +222,18 @@ export function enrichColumns(
|
||||||
collaboratorList: ICollaborator[],
|
collaboratorList: ICollaborator[],
|
||||||
): IRow {
|
): IRow {
|
||||||
Object.keys(row).forEach((key) => {
|
Object.keys(row).forEach((key) => {
|
||||||
let columnDef = metadata.find((obj) => obj.name === key || obj.key === key);
|
const columnDef = metadata.find((obj) => obj.name === key || obj.key === key);
|
||||||
|
|
||||||
if (columnDef?.type === 'collaborator') {
|
if (columnDef?.type === 'collaborator') {
|
||||||
// collaborator is an array of strings.
|
// collaborator is an array of strings.
|
||||||
let collaborators = (row[key] as string[]) || [];
|
const collaborators = (row[key] as string[]) || [];
|
||||||
if (collaborators.length > 0) {
|
if (collaborators.length > 0) {
|
||||||
let newArray = collaborators.map((email) => {
|
const newArray = collaborators.map((email) => {
|
||||||
let collaboratorDetails = getCollaboratorInfo(email, collaboratorList);
|
const collaboratorDetails = getCollaboratorInfo(email, collaboratorList);
|
||||||
let newColl = {
|
const newColl = {
|
||||||
email: email,
|
email,
|
||||||
contact_email: collaboratorDetails['contact_email'],
|
contact_email: collaboratorDetails.contact_email,
|
||||||
name: collaboratorDetails['name'],
|
name: collaboratorDetails.name,
|
||||||
};
|
};
|
||||||
return newColl;
|
return newColl;
|
||||||
});
|
});
|
||||||
|
@ -248,22 +248,22 @@ export function enrichColumns(
|
||||||
columnDef?.key === '_last_modifier'
|
columnDef?.key === '_last_modifier'
|
||||||
) {
|
) {
|
||||||
// creator or last-modifier are always a single string.
|
// creator or last-modifier are always a single string.
|
||||||
let collaboratorDetails = getCollaboratorInfo(row[key] as string, collaboratorList);
|
const collaboratorDetails = getCollaboratorInfo(row[key] as string, collaboratorList);
|
||||||
row[key] = {
|
row[key] = {
|
||||||
email: row[key],
|
email: row[key],
|
||||||
contact_email: collaboratorDetails['contact_email'],
|
contact_email: collaboratorDetails.contact_email,
|
||||||
name: collaboratorDetails['name'],
|
name: collaboratorDetails.name,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (columnDef?.type === 'image') {
|
if (columnDef?.type === 'image') {
|
||||||
let pictures = (row[key] as string[]) || [];
|
const pictures = (row[key] as string[]) || [];
|
||||||
if (pictures.length > 0) {
|
if (pictures.length > 0) {
|
||||||
let newArray = pictures.map((url) => ({
|
const newArray = pictures.map((url) => ({
|
||||||
name: url.split('/').pop(),
|
name: url.split('/').pop(),
|
||||||
size: 0,
|
size: 0,
|
||||||
type: 'image',
|
type: 'image',
|
||||||
url: url,
|
url,
|
||||||
path: getAssetPath('images', url),
|
path: getAssetPath('images', url),
|
||||||
}));
|
}));
|
||||||
row[key] = newArray;
|
row[key] = newArray;
|
||||||
|
@ -271,18 +271,18 @@ export function enrichColumns(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (columnDef?.type === 'file') {
|
if (columnDef?.type === 'file') {
|
||||||
let files = (row[key] as IFile[]) || [];
|
const files = (row[key] as IFile[]) || [];
|
||||||
files.forEach((file) => {
|
files.forEach((file) => {
|
||||||
file.path = getAssetPath('files', file.url);
|
file.path = getAssetPath('files', file.url);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (columnDef?.type === 'digital-sign') {
|
if (columnDef?.type === 'digital-sign') {
|
||||||
let digitalSignature: IColumnDigitalSignature | any = row[key];
|
const digitalSignature: IColumnDigitalSignature | any = row[key];
|
||||||
let collaboratorDetails = getCollaboratorInfo(digitalSignature?.username, collaboratorList);
|
const collaboratorDetails = getCollaboratorInfo(digitalSignature?.username, collaboratorList);
|
||||||
if (digitalSignature?.username) {
|
if (digitalSignature?.username) {
|
||||||
digitalSignature.contact_email = collaboratorDetails['contact_email'];
|
digitalSignature.contact_email = collaboratorDetails.contact_email;
|
||||||
digitalSignature.name = collaboratorDetails['name'];
|
digitalSignature.name = collaboratorDetails.name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,7 +340,7 @@ export function splitStringColumnsToArrays(
|
||||||
|
|
||||||
// remove nonUpdateColumnTypes and only use allowed columns!
|
// remove nonUpdateColumnTypes and only use allowed columns!
|
||||||
export function rowExport(row: IRowObject, columns: TDtableMetadataColumns): IRowObject {
|
export function rowExport(row: IRowObject, columns: TDtableMetadataColumns): IRowObject {
|
||||||
let rowAllowed = {} as IRowObject;
|
const rowAllowed = {} as IRowObject;
|
||||||
columns.map((column) => {
|
columns.map((column) => {
|
||||||
if (row[column.name]) {
|
if (row[column.name]) {
|
||||||
rowAllowed[column.name] = row[column.name];
|
rowAllowed[column.name] = row[column.name];
|
||||||
|
|
|
@ -22,6 +22,6 @@ export class SeaTableV2 implements INodeType {
|
||||||
methods = { loadOptions };
|
methods = { loadOptions };
|
||||||
|
|
||||||
async execute(this: IExecuteFunctions) {
|
async execute(this: IExecuteFunctions) {
|
||||||
return router.call(this);
|
return await router.call(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,5 +17,5 @@ export async function getPublicURL(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.helpers.returnJsonArray(responseData as IDataObject[]);
|
return this.helpers.returnJsonArray(responseData);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
import type { INodeProperties } from 'n8n-workflow';
|
||||||
import * as upload from './upload';
|
import * as upload from './upload';
|
||||||
import * as getPublicURL from './getPublicURL';
|
import * as getPublicURL from './getPublicURL';
|
||||||
import type { INodeProperties } from 'n8n-workflow';
|
|
||||||
|
|
||||||
export { upload, getPublicURL };
|
export { upload, getPublicURL };
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ export async function upload(
|
||||||
const uploadColumn = this.getNodeParameter('uploadColumn', index) as any;
|
const uploadColumn = this.getNodeParameter('uploadColumn', index) as any;
|
||||||
const uploadColumnType = uploadColumn.split(':::')[1];
|
const uploadColumnType = uploadColumn.split(':::')[1];
|
||||||
const uploadColumnName = uploadColumn.split(':::')[0];
|
const uploadColumnName = uploadColumn.split(':::')[0];
|
||||||
const dataPropertyName = this.getNodeParameter('dataPropertyName', index) as string;
|
const dataPropertyName = this.getNodeParameter('dataPropertyName', index);
|
||||||
const tableName = this.getNodeParameter('tableName', index) as string;
|
const tableName = this.getNodeParameter('tableName', index) as string;
|
||||||
const rowId = this.getNodeParameter('rowId', index) as string;
|
const rowId = this.getNodeParameter('rowId', index) as string;
|
||||||
const uploadLink = (await seaTableApiRequest.call(
|
const uploadLink = (await seaTableApiRequest.call(
|
||||||
|
@ -43,7 +43,7 @@ export async function upload(
|
||||||
// if there are already assets attached to the column
|
// if there are already assets attached to the column
|
||||||
let existingAssetArray = [];
|
let existingAssetArray = [];
|
||||||
if (append) {
|
if (append) {
|
||||||
let rowToUpdate = await seaTableApiRequest.call(
|
const rowToUpdate = await seaTableApiRequest.call(
|
||||||
this,
|
this,
|
||||||
{},
|
{},
|
||||||
'GET',
|
'GET',
|
||||||
|
@ -75,7 +75,7 @@ export async function upload(
|
||||||
};
|
};
|
||||||
|
|
||||||
// Send the upload request
|
// Send the upload request
|
||||||
let uploadAsset = await seaTableApiRequest.call(
|
const uploadAsset = await seaTableApiRequest.call(
|
||||||
this,
|
this,
|
||||||
{},
|
{},
|
||||||
'POST',
|
'POST',
|
||||||
|
@ -93,7 +93,7 @@ export async function upload(
|
||||||
row_id: rowId,
|
row_id: rowId,
|
||||||
row: {},
|
row: {},
|
||||||
} as IDataObject;
|
} as IDataObject;
|
||||||
let rowInput = {} as IRowObject;
|
const rowInput = {} as IRowObject;
|
||||||
|
|
||||||
const filePath = `${serverURL}/workspace/${workspaceId}${uploadLink.parent_path}/${relativePath}/${uploadAsset[c].name}`;
|
const filePath = `${serverURL}/workspace/${workspaceId}${uploadLink.parent_path}/${relativePath}/${uploadAsset[c].name}`;
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ export async function upload(
|
||||||
body,
|
body,
|
||||||
);
|
);
|
||||||
|
|
||||||
uploadAsset[c]['upload_successful'] = responseData.success;
|
uploadAsset[c].upload_successful = responseData.success;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.helpers.returnJsonArray(uploadAsset as IDataObject[]);
|
return this.helpers.returnJsonArray(uploadAsset as IDataObject[]);
|
||||||
|
|
|
@ -56,7 +56,8 @@ export const baseApiCallDescription: BaseProperties = [
|
||||||
required: true,
|
required: true,
|
||||||
default: '',
|
default: '',
|
||||||
placeholder: '/dtable-server/...',
|
placeholder: '/dtable-server/...',
|
||||||
description: 'The URL has to start with /dtable-server/ or /dtable-db/. All possible requests can be found at the SeaTable API Reference at https://api.seatable.io Please be aware that only request from the section Base Operations that use an Base-Token for the authentication are allowed to use.',
|
description:
|
||||||
|
'The URL has to start with /dtable-server/ or /dtable-db/. All possible requests can be found at the SeaTable API Reference at https://api.seatable.io Please be aware that only request from the section Base Operations that use an Base-Token for the authentication are allowed to use.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Query String Parameters',
|
displayName: 'Query String Parameters',
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type { IExecuteFunctions, IDataObject, INodeExecutionData } from 'n8n-workflow';
|
import type { IExecuteFunctions, IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||||
import { seaTableApiRequest } from '../../../GenericFunctions';
|
import { seaTableApiRequest } from '../../../GenericFunctions';
|
||||||
import { APITypes } from '../../../types';
|
import type { APITypes } from '../../../types';
|
||||||
|
|
||||||
export async function apiCall(
|
export async function apiCall(
|
||||||
this: IExecuteFunctions,
|
this: IExecuteFunctions,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type { IExecuteFunctions, IDataObject, INodeExecutionData } from 'n8n-workflow';
|
import type { IExecuteFunctions, IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||||
import { seaTableApiRequest } from '../../../GenericFunctions';
|
import { seaTableApiRequest } from '../../../GenericFunctions';
|
||||||
import { ICollaborator } from '../../Interfaces';
|
import type { ICollaborator } from '../../Interfaces';
|
||||||
|
|
||||||
export async function collaborator(
|
export async function collaborator(
|
||||||
this: IExecuteFunctions,
|
this: IExecuteFunctions,
|
||||||
|
@ -16,10 +16,10 @@ export async function collaborator(
|
||||||
);
|
);
|
||||||
const collaborators = collaboratorsResult.user_list || [];
|
const collaborators = collaboratorsResult.user_list || [];
|
||||||
|
|
||||||
const collaborator = collaborators.filter(
|
const data = collaborators.filter(
|
||||||
(col: ICollaborator) =>
|
(col: ICollaborator) =>
|
||||||
col.contact_email.includes(searchString) || col.name.includes(searchString),
|
col.contact_email.includes(searchString) || col.name.includes(searchString),
|
||||||
);
|
);
|
||||||
|
|
||||||
return this.helpers.returnJsonArray(collaborator as IDataObject[]);
|
return this.helpers.returnJsonArray(data as IDataObject[]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
|
import type { INodeProperties } from 'n8n-workflow';
|
||||||
import * as snapshot from './snapshot';
|
import * as snapshot from './snapshot';
|
||||||
import * as metadata from './metadata';
|
import * as metadata from './metadata';
|
||||||
import * as apiCall from './apiCall';
|
import * as apiCall from './apiCall';
|
||||||
import * as collaborator from './collaborator';
|
import * as collaborator from './collaborator';
|
||||||
|
|
||||||
import type { INodeProperties } from 'n8n-workflow';
|
|
||||||
|
|
||||||
export { snapshot, metadata, apiCall, collaborator };
|
export { snapshot, metadata, apiCall, collaborator };
|
||||||
|
|
||||||
export const descriptions: INodeProperties[] = [
|
export const descriptions: INodeProperties[] = [
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
import type { INodeProperties } from 'n8n-workflow';
|
||||||
import * as add from './add';
|
import * as add from './add';
|
||||||
import * as list from './list';
|
import * as list from './list';
|
||||||
import * as remove from './remove';
|
import * as remove from './remove';
|
||||||
import type { INodeProperties } from 'n8n-workflow';
|
|
||||||
|
|
||||||
export { add, list, remove };
|
export { add, list, remove };
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ export async function list(this: IExecuteFunctions, index: number): Promise<INod
|
||||||
const rowId = this.getNodeParameter('rowId', index) as string;
|
const rowId = this.getNodeParameter('rowId', index) as string;
|
||||||
|
|
||||||
// get rows
|
// get rows
|
||||||
let responseData = await seaTableApiRequest.call(
|
const responseData = await seaTableApiRequest.call(
|
||||||
this,
|
this,
|
||||||
{},
|
{},
|
||||||
'POST',
|
'POST',
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import type { IExecuteFunctions, IDataObject, INodeExecutionData } from 'n8n-workflow';
|
import type { IExecuteFunctions, IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||||
import type { IRow, IRowResponse, IDtableMetadataColumn } from './../../Interfaces';
|
|
||||||
import {
|
import {
|
||||||
seaTableApiRequest,
|
seaTableApiRequest,
|
||||||
enrichColumns,
|
enrichColumns,
|
||||||
simplify_new,
|
simplify_new,
|
||||||
getBaseCollaborators,
|
getBaseCollaborators,
|
||||||
} from '../../../GenericFunctions';
|
} from '../../../GenericFunctions';
|
||||||
|
import type { IRowResponse, IDtableMetadataColumn } from './../../Interfaces';
|
||||||
|
|
||||||
export async function get(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
|
export async function get(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
|
||||||
// get parameters
|
// get parameters
|
||||||
|
@ -17,7 +17,7 @@ export async function get(this: IExecuteFunctions, index: number): Promise<INode
|
||||||
const collaborators = await getBaseCollaborators.call(this);
|
const collaborators = await getBaseCollaborators.call(this);
|
||||||
|
|
||||||
// get rows
|
// get rows
|
||||||
let sqlResult = (await seaTableApiRequest.call(
|
const sqlResult = (await seaTableApiRequest.call(
|
||||||
this,
|
this,
|
||||||
{},
|
{},
|
||||||
'POST',
|
'POST',
|
||||||
|
@ -27,8 +27,8 @@ export async function get(this: IExecuteFunctions, index: number): Promise<INode
|
||||||
convert_keys: true,
|
convert_keys: true,
|
||||||
},
|
},
|
||||||
)) as IRowResponse;
|
)) as IRowResponse;
|
||||||
let metadata = sqlResult.metadata as IDtableMetadataColumn[];
|
const metadata = sqlResult.metadata as IDtableMetadataColumn[];
|
||||||
let rows = sqlResult.results as IRow[];
|
const rows = sqlResult.results;
|
||||||
|
|
||||||
// hide columns like button
|
// hide columns like button
|
||||||
rows.map((row) => enrichColumns(row, metadata, collaborators));
|
rows.map((row) => enrichColumns(row, metadata, collaborators));
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import type { INodeProperties } from 'n8n-workflow';
|
||||||
import * as create from './create';
|
import * as create from './create';
|
||||||
import * as get from './get';
|
import * as get from './get';
|
||||||
import * as list from './list';
|
import * as list from './list';
|
||||||
|
@ -6,7 +7,6 @@ import * as update from './update';
|
||||||
import * as remove from './remove';
|
import * as remove from './remove';
|
||||||
import * as lock from './lock';
|
import * as lock from './lock';
|
||||||
import * as unlock from './unlock';
|
import * as unlock from './unlock';
|
||||||
import type { INodeProperties } from 'n8n-workflow';
|
|
||||||
|
|
||||||
export { create, get, search, update, remove, lock, unlock, list };
|
export { create, get, search, update, remove, lock, unlock, list };
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import type { IExecuteFunctions, IDataObject, INodeExecutionData } from 'n8n-workflow';
|
import type { IExecuteFunctions, IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||||
import type { IRow } from './../../Interfaces';
|
|
||||||
import {
|
import {
|
||||||
seaTableApiRequest,
|
seaTableApiRequest,
|
||||||
enrichColumns,
|
enrichColumns,
|
||||||
simplify_new,
|
simplify_new,
|
||||||
getBaseCollaborators,
|
getBaseCollaborators,
|
||||||
} from '../../../GenericFunctions';
|
} from '../../../GenericFunctions';
|
||||||
|
import type { IRow } from './../../Interfaces';
|
||||||
|
|
||||||
export async function list(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
|
export async function list(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
|
||||||
// get parameters
|
// get parameters
|
||||||
|
@ -17,14 +17,14 @@ export async function list(this: IExecuteFunctions, index: number): Promise<INod
|
||||||
const collaborators = await getBaseCollaborators.call(this);
|
const collaborators = await getBaseCollaborators.call(this);
|
||||||
|
|
||||||
// get rows
|
// get rows
|
||||||
let requestMeta = await seaTableApiRequest.call(
|
const requestMeta = await seaTableApiRequest.call(
|
||||||
this,
|
this,
|
||||||
{},
|
{},
|
||||||
'GET',
|
'GET',
|
||||||
'/dtable-server/api/v1/dtables/{{dtable_uuid}}/metadata/',
|
'/dtable-server/api/v1/dtables/{{dtable_uuid}}/metadata/',
|
||||||
);
|
);
|
||||||
|
|
||||||
let requestRows = await seaTableApiRequest.call(
|
const requestRows = await seaTableApiRequest.call(
|
||||||
this,
|
this,
|
||||||
{},
|
{},
|
||||||
'GET',
|
'GET',
|
||||||
|
@ -37,10 +37,10 @@ export async function list(this: IExecuteFunctions, index: number): Promise<INod
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
let metadata =
|
const metadata =
|
||||||
requestMeta.metadata.tables.find((table: { name: string }) => table.name === tableName)
|
requestMeta.metadata.tables.find((table: { name: string }) => table.name === tableName)
|
||||||
?.columns ?? [];
|
?.columns ?? [];
|
||||||
let rows = requestRows.rows as IRow[];
|
const rows = requestRows.rows as IRow[];
|
||||||
|
|
||||||
// hide columns like button
|
// hide columns like button
|
||||||
rows.map((row) => enrichColumns(row, metadata, collaborators));
|
rows.map((row) => enrichColumns(row, metadata, collaborators));
|
||||||
|
|
|
@ -5,7 +5,7 @@ import {
|
||||||
simplify_new,
|
simplify_new,
|
||||||
getBaseCollaborators,
|
getBaseCollaborators,
|
||||||
} from '../../../GenericFunctions';
|
} from '../../../GenericFunctions';
|
||||||
import { IDtableMetadataColumn, IRow, IRowResponse } from '../../Interfaces';
|
import type { IDtableMetadataColumn, IRowResponse } from '../../Interfaces';
|
||||||
|
|
||||||
export async function search(
|
export async function search(
|
||||||
this: IExecuteFunctions,
|
this: IExecuteFunctions,
|
||||||
|
@ -14,7 +14,7 @@ export async function search(
|
||||||
const tableName = this.getNodeParameter('tableName', index) as string;
|
const tableName = this.getNodeParameter('tableName', index) as string;
|
||||||
const searchColumn = this.getNodeParameter('searchColumn', index) as string;
|
const searchColumn = this.getNodeParameter('searchColumn', index) as string;
|
||||||
const searchTerm = this.getNodeParameter('searchTerm', index) as string | number;
|
const searchTerm = this.getNodeParameter('searchTerm', index) as string | number;
|
||||||
let searchTermString = String(searchTerm) as string;
|
let searchTermString = String(searchTerm);
|
||||||
const insensitive = this.getNodeParameter('insensitive', index) as boolean;
|
const insensitive = this.getNodeParameter('insensitive', index) as boolean;
|
||||||
const wildcard = this.getNodeParameter('wildcard', index) as boolean;
|
const wildcard = this.getNodeParameter('wildcard', index) as boolean;
|
||||||
const simple = this.getNodeParameter('simple', index) as boolean;
|
const simple = this.getNodeParameter('simple', index) as boolean;
|
||||||
|
@ -44,7 +44,7 @@ export async function search(
|
||||||
},
|
},
|
||||||
)) as IRowResponse;
|
)) as IRowResponse;
|
||||||
const metadata = sqlResult.metadata as IDtableMetadataColumn[];
|
const metadata = sqlResult.metadata as IDtableMetadataColumn[];
|
||||||
let rows = sqlResult.results as IRow[];
|
const rows = sqlResult.results;
|
||||||
|
|
||||||
// hide columns like button
|
// hide columns like button
|
||||||
rows.map((row) => enrichColumns(row, metadata, collaborators));
|
rows.map((row) => enrichColumns(row, metadata, collaborators));
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable n8n-nodes-base/node-filename-against-convention */
|
||||||
import type { INodeTypeDescription } from 'n8n-workflow';
|
import type { INodeTypeDescription } from 'n8n-workflow';
|
||||||
import * as row from './row';
|
import * as row from './row';
|
||||||
import * as base from './base';
|
import * as base from './base';
|
||||||
|
|
|
@ -37,7 +37,7 @@ export async function getTableNameAndId(
|
||||||
for (const table of tables) {
|
for (const table of tables) {
|
||||||
returnData.push({
|
returnData.push({
|
||||||
name: table.name,
|
name: table.name,
|
||||||
value: table.name + ':::' + table['_id'],
|
value: table.name + ':::' + table._id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return returnData;
|
return returnData;
|
||||||
|
@ -232,7 +232,7 @@ export async function getRowIds(this: ILoadOptionsFunctions): Promise<INodePrope
|
||||||
convert_keys: false,
|
convert_keys: false,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
let rows = sqlResult.results as IRow[];
|
const rows = sqlResult.results as IRow[];
|
||||||
|
|
||||||
for (const row of rows) {
|
for (const row of rows) {
|
||||||
returnData.push({
|
returnData.push({
|
||||||
|
|
|
@ -9,12 +9,12 @@ export type TSeaTableServerEdition = 'enterprise edition';
|
||||||
// dtable
|
// dtable
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
|
|
||||||
|
import type { ICredentialDataDecryptedObject } from 'n8n-workflow';
|
||||||
import type {
|
import type {
|
||||||
IDtableMetadataColumn,
|
IDtableMetadataColumn,
|
||||||
IDtableMetadataTable,
|
IDtableMetadataTable,
|
||||||
TDtableViewColumn,
|
TDtableViewColumn,
|
||||||
} from './actions/Interfaces';
|
} from './actions/Interfaces';
|
||||||
import type { ICredentialDataDecryptedObject } from 'n8n-workflow';
|
|
||||||
|
|
||||||
export type TColumnType =
|
export type TColumnType =
|
||||||
| 'text'
|
| 'text'
|
||||||
|
|
Loading…
Reference in a new issue