From 744b13e67019c50e533fbb936b88db39d352745e Mon Sep 17 00:00:00 2001 From: lawvs <18554747+lawvs@users.noreply.github.com> Date: Sat, 10 Aug 2024 22:08:05 +0800 Subject: [PATCH] feat: allow attaching meta to filter rule --- .changeset/seven-years-exercise.md | 5 +++++ packages/core/src/filter/types.ts | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .changeset/seven-years-exercise.md diff --git a/.changeset/seven-years-exercise.md b/.changeset/seven-years-exercise.md new file mode 100644 index 0000000..63941ef --- /dev/null +++ b/.changeset/seven-years-exercise.md @@ -0,0 +1,5 @@ +--- +"@fn-sphere/core": patch +--- + +Allow attaching meta to filter rule diff --git a/packages/core/src/filter/types.ts b/packages/core/src/filter/types.ts index 1ffd3a8..da2ecf7 100644 --- a/packages/core/src/filter/types.ts +++ b/packages/core/src/filter/types.ts @@ -36,6 +36,7 @@ export interface SingleFilterInput { */ args?: unknown[]; invert?: boolean; + meta?: Record; } export interface SingleFilter extends SingleFilterInput { @@ -54,6 +55,7 @@ export interface FilterGroupInput { op: "and" | "or"; conditions?: FilterRule[]; invert?: boolean; + meta?: Record; } export interface FilterGroup extends FilterGroupInput { @@ -68,9 +70,10 @@ export interface FilterGroup extends FilterGroupInput { export type FilterRule = SingleFilter | FilterGroup; export type StrictSingleFilter = Readonly< - Required & { + Required> & { name: string; path: FilterPath; + meta?: Record; } >; export type StrictFilterGroup = Readonly<{ @@ -82,6 +85,7 @@ export type StrictFilterGroup = Readonly<{ op: "and" | "or"; conditions: StrictFilterRule[]; invert: boolean; + meta?: Record; }>; export type StrictFilterRule = StrictSingleFilter | StrictFilterGroup;