fix(Data Table Node): Update ResourceMapper Copy (no-changelog) (#19048)

This commit is contained in:
Charlie Kolb
2025-09-01 14:16:22 +02:00
committed by GitHub
parent b527edb5f8
commit ec7eddc364
5 changed files with 32 additions and 29 deletions

View File

@@ -1,9 +1,9 @@
import type { DataStoreColumnJsType } from 'n8n-workflow';
export const ANY_FILTER = 'anyFilter';
export const ALL_FILTERS = 'allFilters';
export const ANY_CONDITION = 'anyCondition';
export const ALL_CONDITIONS = 'allConditions';
export type FilterType = typeof ANY_FILTER | typeof ALL_FILTERS;
export type FilterType = typeof ANY_CONDITION | typeof ALL_CONDITIONS;
export type FieldEntry =
| {

View File

@@ -7,7 +7,7 @@ import type {
INodeProperties,
} from 'n8n-workflow';
import type { FilterType } from './constants';
import { ALL_CONDITIONS, ANY_CONDITION, type FilterType } from './constants';
import { DATA_TABLE_ID_FIELD } from './fields';
import { buildGetManyFilter, isFieldArray, isMatchType } from './utils';
@@ -22,16 +22,16 @@ export function getSelectFields(
type: 'options',
options: [
{
name: 'Any Filter',
value: 'anyFilter',
name: 'Any Condition',
value: ANY_CONDITION,
},
{
name: 'All Filters',
value: 'allFilters',
name: 'All Conditions',
value: ALL_CONDITIONS,
},
] satisfies Array<{ value: FilterType; name: string }>,
displayOptions,
default: 'anyFilter',
default: ANY_CONDITION,
},
{
displayName: 'Conditions',
@@ -50,11 +50,13 @@ export function getSelectFields(
name: 'conditions',
values: [
{
displayName: 'Field Name or ID',
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Column',
name: 'keyName',
type: 'options',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
'Choose from the list, or specify using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
typeOptions: {
loadOptionsDependsOn: [DATA_TABLE_ID_FIELD],
loadOptionsMethod: 'getDataTableColumns',
@@ -74,7 +76,7 @@ export function getSelectFields(
default: 'eq',
},
{
displayName: 'Field Value',
displayName: 'Value',
name: 'keyValue',
type: 'string',
default: '',
@@ -94,7 +96,7 @@ export function getSelectFields(
export function getSelectFilter(ctx: IExecuteFunctions, index: number) {
const fields = ctx.getNodeParameter('filters.conditions', index, []);
const matchType = ctx.getNodeParameter('matchType', index, 'anyFilter');
const matchType = ctx.getNodeParameter('matchType', index, ANY_CONDITION);
const node = ctx.getNode();
if (!isMatchType(matchType)) {

View File

@@ -12,7 +12,7 @@ import type {
import { NodeOperationError } from 'n8n-workflow';
import type { FieldEntry, FilterType } from './constants';
import { ALL_FILTERS, ANY_FILTER } from './constants';
import { ALL_CONDITIONS, ANY_CONDITION } from './constants';
import { DATA_TABLE_ID_FIELD } from './fields';
type DateLike = { toISOString: () => string };
@@ -76,7 +76,7 @@ export function isFieldEntry(obj: unknown): obj is FieldEntry {
}
export function isMatchType(obj: unknown): obj is FilterType {
return typeof obj === 'string' && (obj === ANY_FILTER || obj === ALL_FILTERS);
return typeof obj === 'string' && (obj === ANY_CONDITION || obj === ALL_CONDITIONS);
}
export function buildGetManyFilter(
@@ -105,7 +105,7 @@ export function buildGetManyFilter(
};
}
});
return { type: matchType === 'allFilters' ? 'and' : 'or', filters };
return { type: matchType === ALL_CONDITIONS ? 'and' : 'or', filters };
}
export function isFieldArray(value: unknown): value is FieldEntry[] {