@@ -17,11 +17,12 @@ declare namespace EntitiesSearch {
17
17
type Options < V > = Set < ControlOption < V > > ;
18
18
type Value = string | number ;
19
19
20
- interface QueryArguments < V >
20
+ // TODO Can we convert QueryArguments to an Immutable Map?
21
+ interface QueryArguments
21
22
extends Partial <
22
23
Readonly < {
23
- exclude : Set < V > ;
24
- include : Set < V > ;
24
+ exclude : Set < string | number > ;
25
+ include : Set < string | number > ;
25
26
fields : EntitiesSearch . SearchQueryFields ;
26
27
[ p : string ] : unknown ;
27
28
} >
@@ -34,6 +35,8 @@ declare namespace EntitiesSearch {
34
35
url : string ;
35
36
type : string ;
36
37
subtype : string ;
38
+ post_content : string ;
39
+ post_excerpt : string ;
37
40
} > { }
38
41
39
42
type SearchEntitiesFunction < E , K > = (
@@ -42,11 +45,6 @@ declare namespace EntitiesSearch {
42
45
queryArguments ?: EntitiesSearch . QueryArguments < E >
43
46
) => Promise < Options < E > > ;
44
47
45
- type ControlOption < V extends any > = Readonly < {
46
- value : V ;
47
- label : string ;
48
- } > ;
49
-
50
48
type SingularControl < V > = {
51
49
[ K in keyof BaseControl < V > ] : K extends 'value'
52
50
? V
@@ -55,6 +53,20 @@ declare namespace EntitiesSearch {
55
53
: BaseControl < V > [ K ] ;
56
54
} ;
57
55
56
+ interface Record < T > {
57
+ get < F > ( key : string , fallback ?: F ) : T | F | undefined ;
58
+ set ( key : string , value : T ) : Record < T > ;
59
+ }
60
+
61
+ interface ControlOption < V extends any > extends Readonly < {
62
+ value : V ;
63
+ label : string ;
64
+ } > { }
65
+
66
+ interface EnrichedControlOption < V extends any > extends ControlOption < V > , Readonly < {
67
+ readonly extra : Record < string , unknown > ;
68
+ } > { }
69
+
58
70
interface BaseControl < V >
59
71
extends Readonly < {
60
72
value : Set < V > ;
@@ -90,6 +102,7 @@ declare namespace EntitiesSearch {
90
102
/*
91
103
* Api
92
104
*/
105
+ // TODO Better to convert the SearchQueryFields to a Set.
93
106
type SearchQueryFields = ReadonlyArray <
94
107
keyof EntitiesSearch . SearchEntityFields
95
108
> ;
@@ -104,7 +117,6 @@ declare namespace EntitiesSearch {
104
117
> extends Readonly < {
105
118
entities : Entities < E > ;
106
119
kind : Kind < K > ;
107
- contextualEntitiesOptions : OptionSet ;
108
120
currentEntitiesOptions : OptionSet ;
109
121
selectedEntitiesOptions : OptionSet ;
110
122
searchPhrase : string ;
@@ -126,13 +138,6 @@ declare namespace EntitiesSearch {
126
138
K
127
139
> [ 'currentEntitiesOptions' ] ;
128
140
}
129
- | {
130
- type : 'UPDATE_CONTEXTUAL_ENTITIES_OPTIONS' ;
131
- contextualEntitiesOptions : EntitiesState <
132
- E ,
133
- K
134
- > [ 'contextualEntitiesOptions' ] ;
135
- }
136
141
| {
137
142
type : 'UPDATE_SELECTED_ENTITIES_OPTIONS' ;
138
143
selectedEntitiesOptions : EntitiesState <
0 commit comments