@declarion/react 0.44.0 → 0.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,24 @@
1
- import type { Entity, ScreenFilterSpecialValues } from "../../../types/schema";
1
+ import type { Entity, Screen, ScreenFilterSpecialValues } from "../../../types/schema";
2
2
  import type { FilterFieldMeta } from "../../../components/filters/FilterDrawer";
3
- import type { FilterOp } from "../../../lib/filters";
4
- /** Build FilterFieldMeta array from screen + entity for the FilterDrawer. */
5
- export declare function buildFilterFieldMeta(screen: {
6
- filters?: string[];
3
+ /**
4
+ * Build FilterFieldMeta array from screen + entity for the FilterDrawer.
5
+ *
6
+ * The per-type operator lists come from the server (`screen.filter_operators`),
7
+ * never from a table here. The client used to keep its own map and it had
8
+ * already diverged: array, multilang, json and bytes fields fell through to
9
+ * `["eq","not_eq","is_empty","is_not_empty"]`, offering two operators the query
10
+ * builder rejects and hiding `contains`, the one that works. The server owns
11
+ * the field-type -> operator mapping because the server is what enforces it.
12
+ *
13
+ * A field the server published no operators for is OMITTED rather than given a
14
+ * guessed list: an operator the builder rejects is worse than an absent field,
15
+ * because the user only finds out after building the filter.
16
+ *
17
+ * Which fields appear at all is SCREEN-SCOPED - `screen.filters` when declared,
18
+ * every entity field otherwise. That is a UI affordance, not an access control:
19
+ * the server applies no screen scoping to caller filters.
20
+ */
21
+ export declare function buildFilterFieldMeta(screen: (Pick<Screen, "filters"> & {
7
22
  filter_special_values?: Record<string, ScreenFilterSpecialValues>;
8
- } | undefined, entity: Pick<Entity, "fields" | "status_groups" | "properties"> | undefined, entities?: Record<string, Entity>): FilterFieldMeta[];
9
- /** Map field type to available filter operators. */
10
- export declare function fieldTypeToOperators(type: string): FilterOp[];
23
+ filter_operators?: Record<string, string[]>;
24
+ }) | undefined, entity: Pick<Entity, "fields" | "status_groups" | "properties"> | undefined, entities?: Record<string, Entity>): FilterFieldMeta[];
@@ -1,5 +1,6 @@
1
1
  import { type QueryKey } from "@tanstack/react-query";
2
- import type { FilterNodeParam, Refs, V2Meta } from "../types/api";
2
+ import type { Refs, V2Meta } from "../types/api";
3
+ import type { FilterNode } from "../lib/filters";
3
4
  /**
4
5
  * Query-key root for the cursor (infinite) entity list. Distinct from the
5
6
  * offset list's `"entity-data"` so the SSE handler can RESET it (drop pages,
@@ -22,7 +23,7 @@ export declare function cursorEntityStableKey(params: CursorEntityDataParams): s
22
23
  export declare function cursorEntityDataQueryKey(entity: string | undefined, params: CursorEntityDataParams): QueryKey;
23
24
  export interface CursorEntityDataParams {
24
25
  sort?: string;
25
- filters?: FilterNodeParam[];
26
+ filters?: FilterNode[];
26
27
  search?: string;
27
28
  select?: string[];
28
29
  expand?: string[];