Skip to content

Commit

Permalink
improve attributes check on prefilter definition
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskalmar committed Jun 6, 2022
1 parent 0a534e9 commit aa50f13
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/engine/filter.ts
Expand Up @@ -8,10 +8,11 @@ import {
isFunction,
} from './util';
import { isObjectDataType, ObjectDataType } from './datatype/ObjectDataType';
import { DataTypeFunction } from './datatype/DataType';

type PreFilter = {
[key: string]: {
resolve: Function;
resolve: () => unknown;
attributes?: ObjectDataType;
};
};
Expand Down Expand Up @@ -173,6 +174,22 @@ const isPreFilter = (preFilterDefinition: PreFilter) => {
) {
return true;
}

if (isFunction(preFilterDefinition.attributes)) {
const dataTypeBuilder =
preFilterDefinition.attributes as DataTypeFunction;

const attributesType = dataTypeBuilder({
setup: {
name: 'temporary',
description: 'temporary',
},
});

if (isObjectDataType(attributesType)) {
return true;
}
}
}
}

Expand Down

0 comments on commit aa50f13

Please sign in to comment.