@wix/sdk-types 1.17.3 → 1.17.4
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.
- package/build/browser/index.d.mts +272 -78
- package/build/index.d.mts +272 -78
- package/build/index.d.ts +272 -78
- package/internal/build/browser/index.d.mts +272 -78
- package/internal/build/index.d.mts +272 -78
- package/internal/build/index.d.ts +272 -78
- package/package.json +2 -2
|
@@ -837,63 +837,9 @@ type BaseSearch<Entity, Spec extends SearchSpec> = {
|
|
|
837
837
|
*/
|
|
838
838
|
type Search<Entity, Spec extends SearchSpec> = BaseSearch<Entity, Spec> & Partial<Paging<Spec>>;
|
|
839
839
|
|
|
840
|
-
|
|
841
|
-
* Specification for a query API
|
|
842
|
-
* Defines what fields can be filtered and sorted
|
|
843
|
-
* @example
|
|
844
|
-
* interface MyQuerySpec extends QuerySpec {
|
|
845
|
-
* wql: [{
|
|
846
|
-
* operators: ['$eq', '$ne'],
|
|
847
|
-
* fields: ['id', 'title'],
|
|
848
|
-
* sort: 'BOTH'
|
|
849
|
-
* }],
|
|
850
|
-
* paging: 'offset', // or 'cursor' for cursor-based pagination
|
|
851
|
-
* };
|
|
852
|
-
*/
|
|
853
|
-
interface QuerySpec extends WQLSpec {
|
|
854
|
-
/**
|
|
855
|
-
* Supported paging type for this query API
|
|
856
|
-
* - 'cursor': Uses cursor-based pagination
|
|
857
|
-
* - 'offset': Uses offset-based pagination
|
|
858
|
-
*/
|
|
840
|
+
interface PagingSpec {
|
|
859
841
|
paging: PagingType;
|
|
860
842
|
}
|
|
861
|
-
|
|
862
|
-
/**
|
|
863
|
-
* Complete query request for an entity type
|
|
864
|
-
* @template Entity The entity type being queried
|
|
865
|
-
* @template Spec The query specification type
|
|
866
|
-
* @example
|
|
867
|
-
* // Define a query type for products
|
|
868
|
-
* type QueryProducts = Query<Product, ProductQuerySpec>;
|
|
869
|
-
*
|
|
870
|
-
* // Create a query request with offset paging
|
|
871
|
-
* const query: QueryProducts = {
|
|
872
|
-
* filter: { price: { $gte: 10 } },
|
|
873
|
-
* sort: [{ fieldName: 'price', order: 'ASC' }],
|
|
874
|
-
* paging: { limit: 20, offset: 0 }
|
|
875
|
-
* };
|
|
876
|
-
*
|
|
877
|
-
* // Or with cursor paging (if spec.paging = 'cursor')
|
|
878
|
-
* const query: QueryProducts = {
|
|
879
|
-
* filter: { price: { $gte: 10 } },
|
|
880
|
-
* sort: [{ fieldName: 'price', order: 'ASC' }],
|
|
881
|
-
* cursorPaging: { limit: 20, cursor: "..." }
|
|
882
|
-
* };
|
|
883
|
-
*/
|
|
884
|
-
type Query<Entity, Spec extends QuerySpec> = {
|
|
885
|
-
/**
|
|
886
|
-
* Filter object.
|
|
887
|
-
* Learn more about the [filter section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-filter-section).
|
|
888
|
-
*/
|
|
889
|
-
filter?: Filter<Entity, Spec>;
|
|
890
|
-
/**
|
|
891
|
-
* List of sort objects.
|
|
892
|
-
* Learn more about the [sort section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-sort-section).
|
|
893
|
-
*/
|
|
894
|
-
sort?: Sorting<Spec>[];
|
|
895
|
-
} & Partial<Paging<Spec>>;
|
|
896
|
-
|
|
897
843
|
interface CursorPaging {
|
|
898
844
|
limit: number;
|
|
899
845
|
cursor?: string;
|
|
@@ -902,42 +848,31 @@ interface OffsetPaging {
|
|
|
902
848
|
limit: number;
|
|
903
849
|
offset?: number;
|
|
904
850
|
}
|
|
905
|
-
type PagingFor<S extends
|
|
906
|
-
/**
|
|
907
|
-
* The output type from QueryBuilder.build()
|
|
908
|
-
* This is a plain object ready to be sent to an API
|
|
909
|
-
*/
|
|
910
|
-
interface QueryRequest<T, S extends QuerySpec> {
|
|
911
|
-
filter?: Filter<T, S>;
|
|
912
|
-
sort?: Sorting<S>[];
|
|
913
|
-
paging?: PagingFor<S>;
|
|
914
|
-
/** Field projection - return only specified fields */
|
|
915
|
-
fields?: string[];
|
|
916
|
-
}
|
|
851
|
+
type PagingFor<S extends PagingSpec> = S['paging'] extends 'cursor' ? CursorPaging : OffsetPaging;
|
|
917
852
|
/**
|
|
918
853
|
* Represents a filter expression that can be combined with other filters
|
|
919
854
|
*/
|
|
920
|
-
interface FilterExpression<T, S extends
|
|
855
|
+
interface FilterExpression<T, S extends WQLSpec> {
|
|
921
856
|
readonly filter: Filter<T, S>;
|
|
922
857
|
}
|
|
923
858
|
/**
|
|
924
859
|
* Represents a sort expression
|
|
925
860
|
*/
|
|
926
|
-
interface SortExpression<S extends
|
|
861
|
+
interface SortExpression<S extends WQLSpec> {
|
|
927
862
|
readonly sort: Sorting<S>;
|
|
928
863
|
}
|
|
929
864
|
/**
|
|
930
865
|
* Extract fields that support a specific operator from the spec
|
|
931
866
|
*/
|
|
932
|
-
type FieldsWithOperator<S extends
|
|
867
|
+
type FieldsWithOperator<S extends WQLSpec, Op extends string> = S['wql'][number] extends infer Group ? Group extends WQL ? Group['operators'] extends readonly string[] ? Op extends Group['operators'][number] ? Group['fields'][number] : never : Group['fields'][number] : never : never;
|
|
933
868
|
/**
|
|
934
869
|
* Check if a specific field supports a specific operator
|
|
935
870
|
*/
|
|
936
|
-
type HasOperator<S extends
|
|
871
|
+
type HasOperator<S extends WQLSpec, Field extends string, Op extends string> = Field extends FieldsWithOperator<S, Op> ? true : false;
|
|
937
872
|
/**
|
|
938
873
|
* Extract sortable fields from the spec
|
|
939
874
|
*/
|
|
940
|
-
type SortableFields<S extends
|
|
875
|
+
type SortableFields<S extends WQLSpec> = S['wql'][number] extends infer Group ? Group extends {
|
|
941
876
|
fields: readonly string[];
|
|
942
877
|
sort: 'ASC' | 'DESC' | 'BOTH';
|
|
943
878
|
} ? Group['fields'][number] : never : never;
|
|
@@ -952,7 +887,7 @@ type SortableFields<S extends QuerySpec> = S['wql'][number] extends infer Group
|
|
|
952
887
|
* Filter('price').gt(50).lt(100)
|
|
953
888
|
* // Produces: { price: { $gt: 50, $lt: 100 } }
|
|
954
889
|
*/
|
|
955
|
-
type ChainableFieldFilter<T, S extends
|
|
890
|
+
type ChainableFieldFilter<T, S extends WQLSpec, Field extends FilterableFields<S>> = FilterExpression<T, S> & (HasOperator<S, Field & string, '$eq'> extends true ? {
|
|
956
891
|
eq(value: GetNestedType<T, Field & string>): ChainableFieldFilter<T, S, Field>;
|
|
957
892
|
} : {}) & (HasOperator<S, Field & string, '$ne'> extends true ? {
|
|
958
893
|
ne(value: GetNestedType<T, Field & string>): ChainableFieldFilter<T, S, Field>;
|
|
@@ -989,11 +924,11 @@ type ChainableFieldFilter<T, S extends QuerySpec, Field extends FilterableFields
|
|
|
989
924
|
* Filter methods for a specific field (alias for ChainableFieldFilter)
|
|
990
925
|
* Only shows methods for operators that the field supports
|
|
991
926
|
*/
|
|
992
|
-
type FieldFilter<T, S extends
|
|
927
|
+
type FieldFilter<T, S extends WQLSpec, Field extends FilterableFields<S>> = ChainableFieldFilter<T, S, Field>;
|
|
993
928
|
/**
|
|
994
929
|
* Sort methods for a specific field
|
|
995
930
|
*/
|
|
996
|
-
interface FieldSort<S extends
|
|
931
|
+
interface FieldSort<S extends WQLSpec> {
|
|
997
932
|
asc(): SortExpression<S>;
|
|
998
933
|
desc(): SortExpression<S>;
|
|
999
934
|
}
|
|
@@ -1003,7 +938,7 @@ interface FieldSort<S extends QuerySpec> {
|
|
|
1003
938
|
* Filter('price').gt(50)
|
|
1004
939
|
* Filter.and(Filter('title').eq('Product'), Filter('price').gt(50))
|
|
1005
940
|
*/
|
|
1006
|
-
interface FilterFactory<T, S extends
|
|
941
|
+
interface FilterFactory<T, S extends WQLSpec> {
|
|
1007
942
|
/** Create a field-specific filter */
|
|
1008
943
|
<Field extends FilterableFields<S>>(field: Field): FieldFilter<T, S, Field>;
|
|
1009
944
|
/** Combine filters with AND logic */
|
|
@@ -1018,7 +953,266 @@ interface FilterFactory<T, S extends QuerySpec> {
|
|
|
1018
953
|
* @example
|
|
1019
954
|
* Sort('price').desc()
|
|
1020
955
|
*/
|
|
1021
|
-
type SortFactory<S extends
|
|
956
|
+
type SortFactory<S extends WQLSpec> = <Field extends SortableFields<S>>(field: Field) => FieldSort<S>;
|
|
957
|
+
|
|
958
|
+
/**
|
|
959
|
+
* The output type from SearchBuilder.build()
|
|
960
|
+
* This is a plain object ready to be sent to an API
|
|
961
|
+
*/
|
|
962
|
+
interface SearchRequest<T, S extends SearchSpec> {
|
|
963
|
+
/** Filter object */
|
|
964
|
+
filter?: Filter<T, S>;
|
|
965
|
+
/** List of sort objects */
|
|
966
|
+
sort?: Sorting<S>[];
|
|
967
|
+
/** Full-text search parameters */
|
|
968
|
+
search?: SearchDetails<S>;
|
|
969
|
+
/** Aggregations to compute */
|
|
970
|
+
aggregations?: Aggregation<S>[];
|
|
971
|
+
/** Paging configuration */
|
|
972
|
+
paging?: PagingFor<S>;
|
|
973
|
+
/** Time zone for date operations */
|
|
974
|
+
timeZone?: string;
|
|
975
|
+
}
|
|
976
|
+
/**
|
|
977
|
+
* Represents a search expression that can be used in SearchBuilder
|
|
978
|
+
*/
|
|
979
|
+
interface SearchExpression<S extends SearchSpec> {
|
|
980
|
+
readonly search: SearchDetails<S>;
|
|
981
|
+
}
|
|
982
|
+
/**
|
|
983
|
+
* Represents an aggregation expression that can be used in SearchBuilder
|
|
984
|
+
*/
|
|
985
|
+
interface AggregationExpression<S extends SearchSpec> {
|
|
986
|
+
readonly aggregation: Aggregation<S>;
|
|
987
|
+
}
|
|
988
|
+
/**
|
|
989
|
+
* Builder for constructing search parameters
|
|
990
|
+
* @example
|
|
991
|
+
* SearchParams('dark shoes')
|
|
992
|
+
* .mode('AND')
|
|
993
|
+
* .fields(['productName', 'description'])
|
|
994
|
+
* .fuzzy(true)
|
|
995
|
+
*/
|
|
996
|
+
interface SearchParamsBuilder<S extends SearchSpec> extends SearchExpression<S> {
|
|
997
|
+
/** Set the search expression/query string */
|
|
998
|
+
expression(expr: string): SearchParamsBuilder<S>;
|
|
999
|
+
/** Set the search mode (how to combine multiple terms) */
|
|
1000
|
+
mode(mode: 'AND' | 'OR'): SearchParamsBuilder<S>;
|
|
1001
|
+
/** Set the fields to search in */
|
|
1002
|
+
fields(fields: SearchableFields<S>[]): SearchParamsBuilder<S>;
|
|
1003
|
+
/** Enable or disable fuzzy matching */
|
|
1004
|
+
fuzzy(enabled?: boolean): SearchParamsBuilder<S>;
|
|
1005
|
+
}
|
|
1006
|
+
/**
|
|
1007
|
+
* Factory function for creating SearchParamsBuilder
|
|
1008
|
+
* @param expression - Optional search expression to initialize with
|
|
1009
|
+
*/
|
|
1010
|
+
type SearchParamsFactory<S extends SearchSpec> = (expression?: string) => SearchParamsBuilder<S>;
|
|
1011
|
+
/**
|
|
1012
|
+
* Sort configuration for value aggregations
|
|
1013
|
+
*/
|
|
1014
|
+
interface ValueAggregationSort {
|
|
1015
|
+
sortBy(type: 'COUNT' | 'VALUE', direction: 'ASC' | 'DESC'): this;
|
|
1016
|
+
}
|
|
1017
|
+
/**
|
|
1018
|
+
* Builder for VALUE type aggregations
|
|
1019
|
+
*/
|
|
1020
|
+
interface ValueAggregationBuilder<S extends SearchSpec> extends AggregationExpression<S>, ValueAggregationSort {
|
|
1021
|
+
/** Set maximum number of buckets to return */
|
|
1022
|
+
limit(count: number): ValueAggregationBuilder<S>;
|
|
1023
|
+
/** Exclude documents with missing values */
|
|
1024
|
+
excludeMissingValues(): ValueAggregationBuilder<S>;
|
|
1025
|
+
/** Include documents with missing values */
|
|
1026
|
+
includeMissingValues(): ValueAggregationBuilder<S>;
|
|
1027
|
+
/** Include specific values in their own bucket */
|
|
1028
|
+
includeValues(addToBucket: string): ValueAggregationBuilder<S>;
|
|
1029
|
+
}
|
|
1030
|
+
/**
|
|
1031
|
+
* Builder for RANGE type aggregations
|
|
1032
|
+
*/
|
|
1033
|
+
interface RangeAggregationBuilder<S extends SearchSpec> extends AggregationExpression<S> {
|
|
1034
|
+
/** Set the range buckets */
|
|
1035
|
+
withBuckets(...buckets: {
|
|
1036
|
+
from?: number | null;
|
|
1037
|
+
to?: number | null;
|
|
1038
|
+
}[]): RangeAggregationBuilder<S>;
|
|
1039
|
+
}
|
|
1040
|
+
/**
|
|
1041
|
+
* Builder for DATE_HISTOGRAM type aggregations
|
|
1042
|
+
*/
|
|
1043
|
+
interface DateHistogramAggregationBuilder<S extends SearchSpec> extends AggregationExpression<S> {
|
|
1044
|
+
/** Set the interval for date histogram buckets */
|
|
1045
|
+
interval(interval: 'YEAR' | 'MONTH' | 'WEEK' | 'DAY' | 'HOUR' | 'MINUTE' | 'SECOND'): DateHistogramAggregationBuilder<S>;
|
|
1046
|
+
}
|
|
1047
|
+
/**
|
|
1048
|
+
* Builder for SCALAR type aggregations
|
|
1049
|
+
*/
|
|
1050
|
+
interface ScalarAggregationBuilder<S extends SearchSpec> extends AggregationExpression<S> {
|
|
1051
|
+
/** Set the scalar aggregation type */
|
|
1052
|
+
type(scalarType: 'COUNT_DISTINCT' | 'MIN' | 'MAX' | 'SUM' | 'AVG'): ScalarAggregationBuilder<S>;
|
|
1053
|
+
}
|
|
1054
|
+
/**
|
|
1055
|
+
* Builder for NESTED type aggregations
|
|
1056
|
+
*/
|
|
1057
|
+
interface NestedAggregationBuilder<S extends SearchSpec> extends AggregationExpression<S> {
|
|
1058
|
+
/** Add a nested aggregation */
|
|
1059
|
+
addNestedAggregation(aggregation: AggregationExpression<S>): NestedAggregationBuilder<S>;
|
|
1060
|
+
}
|
|
1061
|
+
/**
|
|
1062
|
+
* Aggregation type configuration
|
|
1063
|
+
*/
|
|
1064
|
+
type AggregationType = 'VALUE' | 'RANGE' | 'DATE_HISTOGRAM' | 'SCALAR' | 'NESTED';
|
|
1065
|
+
/**
|
|
1066
|
+
* Builder for constructing aggregations
|
|
1067
|
+
* @example
|
|
1068
|
+
* Aggregation('status_count')
|
|
1069
|
+
* .ofType('VALUE')
|
|
1070
|
+
* .onField('status')
|
|
1071
|
+
* .asValueAggregation()
|
|
1072
|
+
* .sortBy('COUNT', 'DESC')
|
|
1073
|
+
* .limit(10)
|
|
1074
|
+
*/
|
|
1075
|
+
interface AggregationBuilder<S extends SearchSpec> extends AggregationExpression<S> {
|
|
1076
|
+
/** Set the aggregation type */
|
|
1077
|
+
ofType(type: AggregationType): AggregationBuilder<S>;
|
|
1078
|
+
/** Set the field to aggregate on */
|
|
1079
|
+
onField(field: AggregatableFields<S>): AggregationBuilder<S>;
|
|
1080
|
+
/** Configure as a value aggregation */
|
|
1081
|
+
asValueAggregation(): ValueAggregationBuilder<S>;
|
|
1082
|
+
/** Configure as a range aggregation */
|
|
1083
|
+
asRangeAggregation(): RangeAggregationBuilder<S>;
|
|
1084
|
+
/** Configure as a date histogram aggregation */
|
|
1085
|
+
asDateHistogramAggregation(): DateHistogramAggregationBuilder<S>;
|
|
1086
|
+
/** Configure as a scalar aggregation */
|
|
1087
|
+
asScalarAggregation(): ScalarAggregationBuilder<S>;
|
|
1088
|
+
/** Configure as a nested aggregation */
|
|
1089
|
+
asNestedAggregation(): NestedAggregationBuilder<S>;
|
|
1090
|
+
}
|
|
1091
|
+
/**
|
|
1092
|
+
* Factory function for creating AggregationBuilder
|
|
1093
|
+
*/
|
|
1094
|
+
type AggregationFactory<S extends SearchSpec> = (name: string) => AggregationBuilder<S>;
|
|
1095
|
+
/**
|
|
1096
|
+
* Search builder interface for constructing search requests
|
|
1097
|
+
* @template T - Entity type
|
|
1098
|
+
* @template S - Search spec defining filterable/sortable/searchable/aggregatable fields
|
|
1099
|
+
* @template R - Output type from build() (defaults to SearchRequest<T, S>)
|
|
1100
|
+
* @example
|
|
1101
|
+
* SearchBuilder()
|
|
1102
|
+
* .withFilter(Filter.and(
|
|
1103
|
+
* Filter('title').eq('Product'),
|
|
1104
|
+
* Filter('price').gt(50)
|
|
1105
|
+
* ))
|
|
1106
|
+
* .withSearchClause(SearchParams('shoes').fuzzy(true))
|
|
1107
|
+
* .withAggregation(Aggregation('status_count').ofType('VALUE').onField('status'))
|
|
1108
|
+
* .withSorting(Sort('price').desc())
|
|
1109
|
+
* .withPaging({ limit: 20 })
|
|
1110
|
+
* .build()
|
|
1111
|
+
*/
|
|
1112
|
+
interface SearchBuilder<T, S extends SearchSpec, R = SearchRequest<T, S>> {
|
|
1113
|
+
/** Add a filter to the search */
|
|
1114
|
+
withFilter(filter: FilterExpression<T, S>): SearchBuilder<T, S, R>;
|
|
1115
|
+
/** Add a search clause for full-text search */
|
|
1116
|
+
withSearchClause(search: SearchExpression<S>): SearchBuilder<T, S, R>;
|
|
1117
|
+
/** Add sorting to the search */
|
|
1118
|
+
withSorting(...sorts: SortExpression<S>[]): SearchBuilder<T, S, R>;
|
|
1119
|
+
/** Add aggregations to the search */
|
|
1120
|
+
withAggregation(...aggregations: AggregationExpression<S>[]): SearchBuilder<T, S, R>;
|
|
1121
|
+
/** Add paging to the search */
|
|
1122
|
+
withPaging(paging: PagingFor<S>): SearchBuilder<T, S, R>;
|
|
1123
|
+
/** Set the time zone for date operations */
|
|
1124
|
+
withTimeZone(timeZone: string): SearchBuilder<T, S, R>;
|
|
1125
|
+
/** Build the final search request object */
|
|
1126
|
+
build(): R;
|
|
1127
|
+
}
|
|
1128
|
+
/**
|
|
1129
|
+
* Complete set of search helpers for an entity
|
|
1130
|
+
* This is what gets spread into module namespaces
|
|
1131
|
+
* @template T - Entity type
|
|
1132
|
+
* @template S - Search spec defining filterable/sortable/searchable/aggregatable fields
|
|
1133
|
+
* @template R - Output type from SearchBuilder.build() (defaults to SearchRequest<T, S>)
|
|
1134
|
+
*/
|
|
1135
|
+
interface SearchHelpers<T, S extends SearchSpec, R = SearchRequest<T, S>> {
|
|
1136
|
+
/** SearchBuilder factory */
|
|
1137
|
+
SearchBuilder: () => SearchBuilder<T, S, R>;
|
|
1138
|
+
/** Filter factory - creates filter expressions (reused from query) */
|
|
1139
|
+
Filter: FilterFactory<T, S>;
|
|
1140
|
+
/** Sort factory - creates sort expressions (reused from query) */
|
|
1141
|
+
Sort: SortFactory<S>;
|
|
1142
|
+
/** Search params factory - creates search expressions */
|
|
1143
|
+
SearchParams: SearchParamsFactory<S>;
|
|
1144
|
+
/** Aggregation factory - creates aggregation expressions */
|
|
1145
|
+
Aggregation: AggregationFactory<S>;
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
/**
|
|
1149
|
+
* Specification for a query API
|
|
1150
|
+
* Defines what fields can be filtered and sorted
|
|
1151
|
+
* @example
|
|
1152
|
+
* interface MyQuerySpec extends QuerySpec {
|
|
1153
|
+
* wql: [{
|
|
1154
|
+
* operators: ['$eq', '$ne'],
|
|
1155
|
+
* fields: ['id', 'title'],
|
|
1156
|
+
* sort: 'BOTH'
|
|
1157
|
+
* }],
|
|
1158
|
+
* paging: 'offset', // or 'cursor' for cursor-based pagination
|
|
1159
|
+
* };
|
|
1160
|
+
*/
|
|
1161
|
+
interface QuerySpec extends WQLSpec {
|
|
1162
|
+
/**
|
|
1163
|
+
* Supported paging type for this query API
|
|
1164
|
+
* - 'cursor': Uses cursor-based pagination
|
|
1165
|
+
* - 'offset': Uses offset-based pagination
|
|
1166
|
+
*/
|
|
1167
|
+
paging: PagingType;
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
/**
|
|
1171
|
+
* Complete query request for an entity type
|
|
1172
|
+
* @template Entity The entity type being queried
|
|
1173
|
+
* @template Spec The query specification type
|
|
1174
|
+
* @example
|
|
1175
|
+
* // Define a query type for products
|
|
1176
|
+
* type QueryProducts = Query<Product, ProductQuerySpec>;
|
|
1177
|
+
*
|
|
1178
|
+
* // Create a query request with offset paging
|
|
1179
|
+
* const query: QueryProducts = {
|
|
1180
|
+
* filter: { price: { $gte: 10 } },
|
|
1181
|
+
* sort: [{ fieldName: 'price', order: 'ASC' }],
|
|
1182
|
+
* paging: { limit: 20, offset: 0 }
|
|
1183
|
+
* };
|
|
1184
|
+
*
|
|
1185
|
+
* // Or with cursor paging (if spec.paging = 'cursor')
|
|
1186
|
+
* const query: QueryProducts = {
|
|
1187
|
+
* filter: { price: { $gte: 10 } },
|
|
1188
|
+
* sort: [{ fieldName: 'price', order: 'ASC' }],
|
|
1189
|
+
* cursorPaging: { limit: 20, cursor: "..." }
|
|
1190
|
+
* };
|
|
1191
|
+
*/
|
|
1192
|
+
type Query<Entity, Spec extends QuerySpec> = {
|
|
1193
|
+
/**
|
|
1194
|
+
* Filter object.
|
|
1195
|
+
* Learn more about the [filter section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-filter-section).
|
|
1196
|
+
*/
|
|
1197
|
+
filter?: Filter<Entity, Spec>;
|
|
1198
|
+
/**
|
|
1199
|
+
* List of sort objects.
|
|
1200
|
+
* Learn more about the [sort section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-sort-section).
|
|
1201
|
+
*/
|
|
1202
|
+
sort?: Sorting<Spec>[];
|
|
1203
|
+
} & Partial<Paging<Spec>>;
|
|
1204
|
+
|
|
1205
|
+
/**
|
|
1206
|
+
* The output type from QueryBuilder.build()
|
|
1207
|
+
* This is a plain object ready to be sent to an API
|
|
1208
|
+
*/
|
|
1209
|
+
interface QueryRequest<T, S extends QuerySpec> {
|
|
1210
|
+
filter?: Filter<T, S>;
|
|
1211
|
+
sort?: Sorting<S>[];
|
|
1212
|
+
paging?: PagingFor<S>;
|
|
1213
|
+
/** Field projection - return only specified fields */
|
|
1214
|
+
fields?: string[];
|
|
1215
|
+
}
|
|
1022
1216
|
/**
|
|
1023
1217
|
* Query builder interface
|
|
1024
1218
|
* @template T - Entity type
|
|
@@ -1063,4 +1257,4 @@ interface QueryHelpers<T, S extends QuerySpec, R = QueryRequest<T, S>> {
|
|
|
1063
1257
|
Sort: SortFactory<S>;
|
|
1064
1258
|
}
|
|
1065
1259
|
|
|
1066
|
-
export { type APIMetadata, type AccountInfo, type AmbassadorFactory, type AmbassadorFunctionDescriptor, type AmbassadorRequestOptions, type AuthenticationStrategy, type BaseEventMetadata, type BoundAuthenticationStrategy, type BuildAmbassadorFunction, type BuildDescriptors, type BuildEventDefinition, type BuildRESTFunction, type BuildServicePluginDefinition, type CursorPaging, type Descriptors, EventDefinition, type EventHandler, type EventIdentity, type ExposeFieldsBasedOnToggle, type FieldFilter, type FieldSort, type Filter, type FilterExpression, type FilterFactory, type FilterableFields, type GetNestedType, type HTTPMethod, type Host, type HostModule, type HostModuleAPI, type HttpClient, type HttpResponse, type MaybeContext, type Method, type MigrationOptions, type NonNullablePaths, type OffsetPaging, type PagingFor, type PublicMetadata, type Query, type QueryBuilder, type QueryHelpers, type QueryRequest, type QuerySpec, type RESTFunctionDescriptor, type RequestContext, type RequestOptions, type RequestOptionsFactory, type RestModuleMeta, SERVICE_PLUGIN_ERROR_TYPE, SORT_CAPABILITIES, SORT_DIRECTIONS, type Search, type SearchSpec, type ServicePluginContract, ServicePluginDefinition, type ServicePluginMethodInput, type ServicePluginMethodMetadata, type SortCapability, type SortExpression, type SortFactory, type SortOrder, type Sorting, type WQL, type WQLSpec };
|
|
1260
|
+
export { type APIMetadata, type AccountInfo, type AggregatableFields, type Aggregation, type AggregationBuilder, type AggregationExpression, type AggregationFactory, type AggregationType, type AmbassadorFactory, type AmbassadorFunctionDescriptor, type AmbassadorRequestOptions, type AuthenticationStrategy, type BaseEventMetadata, type BoundAuthenticationStrategy, type BuildAmbassadorFunction, type BuildDescriptors, type BuildEventDefinition, type BuildRESTFunction, type BuildServicePluginDefinition, type CursorPaging, type DateHistogramAggregationBuilder, type Descriptors, EventDefinition, type EventHandler, type EventIdentity, type ExposeFieldsBasedOnToggle, type FieldFilter, type FieldSort, type Filter, type FilterExpression, type FilterFactory, type FilterableFields, type GetNestedType, type HTTPMethod, type Host, type HostModule, type HostModuleAPI, type HttpClient, type HttpResponse, type MaybeContext, type Method, type MigrationOptions, type NestedAggregationBuilder, type NonNullablePaths, type OffsetPaging, type PagingFor, type PublicMetadata, type Query, type QueryBuilder, type QueryHelpers, type QueryRequest, type QuerySpec, type RESTFunctionDescriptor, type RangeAggregationBuilder, type RequestContext, type RequestOptions, type RequestOptionsFactory, type RestModuleMeta, SERVICE_PLUGIN_ERROR_TYPE, SORT_CAPABILITIES, SORT_DIRECTIONS, type ScalarAggregationBuilder, type Search, type SearchBuilder, type SearchDetails, type SearchExpression, type SearchHelpers, type SearchParamsBuilder, type SearchParamsFactory, type SearchRequest, type SearchSpec, type SearchableFields, type ServicePluginContract, ServicePluginDefinition, type ServicePluginMethodInput, type ServicePluginMethodMetadata, type SortCapability, type SortExpression, type SortFactory, type SortOrder, type Sorting, type ValueAggregationBuilder, type ValueAggregationSort, type WQL, type WQLSpec };
|