-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: update changeset * refactor: rename `LooseFilterRule` to `SingleFilter` * chore: export `FilterGroup` * chore: add type export for filter specs * chore: add changeset * chore: update snapshot
- Loading branch information
Showing
35 changed files
with
239 additions
and
237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
--- | ||
"@fn-sphere/filter": patch | ||
"@fn-sphere/core": patch | ||
--- | ||
|
||
`getParametersExceptFirst` now returns an array instead of a Zod tuple. | ||
|
||
```ts | ||
import { getParametersExceptFirst } from "@fn-sphere/core"; | ||
|
||
const schema = { | ||
name: "test", | ||
define: z.function().args(z.number(), z.boolean()).returns(z.void()), | ||
implement: () => {}, | ||
}; | ||
|
||
isSameType(z.tuple(getParametersExceptFirst(schema)), z.tuple([z.boolean()])); | ||
// true | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@fn-sphere/filter": patch | ||
--- | ||
|
||
chore: add type export for filter specs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
"@fn-sphere/filter": patch | ||
"@fn-sphere/core": patch | ||
--- | ||
|
||
Rename and export `FilterRule` | ||
|
||
```ts | ||
interface SingleFilter { | ||
type: "Filter"; | ||
/** | ||
* Field path | ||
* | ||
* If it's a empty array, it means the root object. | ||
* If not provided, it means user didn't select a field. | ||
*/ | ||
path?: FilterPath; | ||
/** | ||
* Filter name | ||
* | ||
* If not provided, it means user didn't select a filter. | ||
*/ | ||
name?: string; | ||
/** | ||
* Arguments for the filter function | ||
*/ | ||
args: unknown[]; | ||
invert?: boolean; | ||
} | ||
|
||
interface SingleFilter extends SingleFilterInput { | ||
/** | ||
* Unique id, used for tracking changes or resorting | ||
*/ | ||
id: FilterId; | ||
} | ||
|
||
export interface FilterGroupInput { | ||
type: "FilterGroup"; | ||
op: "and" | "or"; | ||
conditions: (SingleFilter | FilterGroup)[]; | ||
invert?: boolean; | ||
} | ||
|
||
export interface FilterGroup extends FilterGroupInput { | ||
/** | ||
* Unique id, used for tracking changes or resorting | ||
*/ | ||
id: FilterId; | ||
} | ||
|
||
export type FilterRule = SingleFilter | FilterGroup; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.