@wix/sdk-types 1.17.3 → 1.17.5
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 +277 -78
- package/build/index.d.mts +277 -78
- package/build/index.d.ts +277 -78
- package/internal/build/browser/index.d.mts +277 -78
- package/internal/build/index.d.mts +277 -78
- package/internal/build/index.d.ts +277 -78
- package/package.json +2 -2
|
@@ -131,7 +131,12 @@ interface HttpClient {
|
|
|
131
131
|
request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
|
|
132
132
|
fetchWithAuth: typeof fetch;
|
|
133
133
|
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
|
|
134
|
+
/** Returns the current access token synchronously, if available. */
|
|
134
135
|
getActiveToken?: () => string | undefined;
|
|
136
|
+
/** Returns auth headers (may trigger token refresh). Prefer this over getActiveToken when making authenticated requests. */
|
|
137
|
+
getAuthHeaders?: () => Promise<{
|
|
138
|
+
headers: Record<string, string>;
|
|
139
|
+
}>;
|
|
135
140
|
}
|
|
136
141
|
type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
|
|
137
142
|
type HttpResponse<T = any> = {
|
|
@@ -895,63 +900,9 @@ type BaseSearch<Entity, Spec extends SearchSpec> = {
|
|
|
895
900
|
*/
|
|
896
901
|
type Search<Entity, Spec extends SearchSpec> = BaseSearch<Entity, Spec> & Partial<Paging<Spec>>;
|
|
897
902
|
|
|
898
|
-
|
|
899
|
-
* Specification for a query API
|
|
900
|
-
* Defines what fields can be filtered and sorted
|
|
901
|
-
* @example
|
|
902
|
-
* interface MyQuerySpec extends QuerySpec {
|
|
903
|
-
* wql: [{
|
|
904
|
-
* operators: ['$eq', '$ne'],
|
|
905
|
-
* fields: ['id', 'title'],
|
|
906
|
-
* sort: 'BOTH'
|
|
907
|
-
* }],
|
|
908
|
-
* paging: 'offset', // or 'cursor' for cursor-based pagination
|
|
909
|
-
* };
|
|
910
|
-
*/
|
|
911
|
-
interface QuerySpec extends WQLSpec {
|
|
912
|
-
/**
|
|
913
|
-
* Supported paging type for this query API
|
|
914
|
-
* - 'cursor': Uses cursor-based pagination
|
|
915
|
-
* - 'offset': Uses offset-based pagination
|
|
916
|
-
*/
|
|
903
|
+
interface PagingSpec {
|
|
917
904
|
paging: PagingType;
|
|
918
905
|
}
|
|
919
|
-
|
|
920
|
-
/**
|
|
921
|
-
* Complete query request for an entity type
|
|
922
|
-
* @template Entity The entity type being queried
|
|
923
|
-
* @template Spec The query specification type
|
|
924
|
-
* @example
|
|
925
|
-
* // Define a query type for products
|
|
926
|
-
* type QueryProducts = Query<Product, ProductQuerySpec>;
|
|
927
|
-
*
|
|
928
|
-
* // Create a query request with offset paging
|
|
929
|
-
* const query: QueryProducts = {
|
|
930
|
-
* filter: { price: { $gte: 10 } },
|
|
931
|
-
* sort: [{ fieldName: 'price', order: 'ASC' }],
|
|
932
|
-
* paging: { limit: 20, offset: 0 }
|
|
933
|
-
* };
|
|
934
|
-
*
|
|
935
|
-
* // Or with cursor paging (if spec.paging = 'cursor')
|
|
936
|
-
* const query: QueryProducts = {
|
|
937
|
-
* filter: { price: { $gte: 10 } },
|
|
938
|
-
* sort: [{ fieldName: 'price', order: 'ASC' }],
|
|
939
|
-
* cursorPaging: { limit: 20, cursor: "..." }
|
|
940
|
-
* };
|
|
941
|
-
*/
|
|
942
|
-
type Query<Entity, Spec extends QuerySpec> = {
|
|
943
|
-
/**
|
|
944
|
-
* Filter object.
|
|
945
|
-
* Learn more about the [filter section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-filter-section).
|
|
946
|
-
*/
|
|
947
|
-
filter?: Filter<Entity, Spec>;
|
|
948
|
-
/**
|
|
949
|
-
* List of sort objects.
|
|
950
|
-
* Learn more about the [sort section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-sort-section).
|
|
951
|
-
*/
|
|
952
|
-
sort?: Sorting<Spec>[];
|
|
953
|
-
} & Partial<Paging<Spec>>;
|
|
954
|
-
|
|
955
906
|
interface CursorPaging {
|
|
956
907
|
limit: number;
|
|
957
908
|
cursor?: string;
|
|
@@ -960,42 +911,31 @@ interface OffsetPaging {
|
|
|
960
911
|
limit: number;
|
|
961
912
|
offset?: number;
|
|
962
913
|
}
|
|
963
|
-
type PagingFor<S extends
|
|
964
|
-
/**
|
|
965
|
-
* The output type from QueryBuilder.build()
|
|
966
|
-
* This is a plain object ready to be sent to an API
|
|
967
|
-
*/
|
|
968
|
-
interface QueryRequest<T, S extends QuerySpec> {
|
|
969
|
-
filter?: Filter<T, S>;
|
|
970
|
-
sort?: Sorting<S>[];
|
|
971
|
-
paging?: PagingFor<S>;
|
|
972
|
-
/** Field projection - return only specified fields */
|
|
973
|
-
fields?: string[];
|
|
974
|
-
}
|
|
914
|
+
type PagingFor<S extends PagingSpec> = S['paging'] extends 'cursor' ? CursorPaging : OffsetPaging;
|
|
975
915
|
/**
|
|
976
916
|
* Represents a filter expression that can be combined with other filters
|
|
977
917
|
*/
|
|
978
|
-
interface FilterExpression<T, S extends
|
|
918
|
+
interface FilterExpression<T, S extends WQLSpec> {
|
|
979
919
|
readonly filter: Filter<T, S>;
|
|
980
920
|
}
|
|
981
921
|
/**
|
|
982
922
|
* Represents a sort expression
|
|
983
923
|
*/
|
|
984
|
-
interface SortExpression<S extends
|
|
924
|
+
interface SortExpression<S extends WQLSpec> {
|
|
985
925
|
readonly sort: Sorting<S>;
|
|
986
926
|
}
|
|
987
927
|
/**
|
|
988
928
|
* Extract fields that support a specific operator from the spec
|
|
989
929
|
*/
|
|
990
|
-
type FieldsWithOperator<S extends
|
|
930
|
+
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;
|
|
991
931
|
/**
|
|
992
932
|
* Check if a specific field supports a specific operator
|
|
993
933
|
*/
|
|
994
|
-
type HasOperator<S extends
|
|
934
|
+
type HasOperator<S extends WQLSpec, Field extends string, Op extends string> = Field extends FieldsWithOperator<S, Op> ? true : false;
|
|
995
935
|
/**
|
|
996
936
|
* Extract sortable fields from the spec
|
|
997
937
|
*/
|
|
998
|
-
type SortableFields<S extends
|
|
938
|
+
type SortableFields<S extends WQLSpec> = S['wql'][number] extends infer Group ? Group extends {
|
|
999
939
|
fields: readonly string[];
|
|
1000
940
|
sort: 'ASC' | 'DESC' | 'BOTH';
|
|
1001
941
|
} ? Group['fields'][number] : never : never;
|
|
@@ -1010,7 +950,7 @@ type SortableFields<S extends QuerySpec> = S['wql'][number] extends infer Group
|
|
|
1010
950
|
* Filter('price').gt(50).lt(100)
|
|
1011
951
|
* // Produces: { price: { $gt: 50, $lt: 100 } }
|
|
1012
952
|
*/
|
|
1013
|
-
type ChainableFieldFilter<T, S extends
|
|
953
|
+
type ChainableFieldFilter<T, S extends WQLSpec, Field extends FilterableFields<S>> = FilterExpression<T, S> & (HasOperator<S, Field & string, '$eq'> extends true ? {
|
|
1014
954
|
eq(value: GetNestedType<T, Field & string>): ChainableFieldFilter<T, S, Field>;
|
|
1015
955
|
} : {}) & (HasOperator<S, Field & string, '$ne'> extends true ? {
|
|
1016
956
|
ne(value: GetNestedType<T, Field & string>): ChainableFieldFilter<T, S, Field>;
|
|
@@ -1047,11 +987,11 @@ type ChainableFieldFilter<T, S extends QuerySpec, Field extends FilterableFields
|
|
|
1047
987
|
* Filter methods for a specific field (alias for ChainableFieldFilter)
|
|
1048
988
|
* Only shows methods for operators that the field supports
|
|
1049
989
|
*/
|
|
1050
|
-
type FieldFilter<T, S extends
|
|
990
|
+
type FieldFilter<T, S extends WQLSpec, Field extends FilterableFields<S>> = ChainableFieldFilter<T, S, Field>;
|
|
1051
991
|
/**
|
|
1052
992
|
* Sort methods for a specific field
|
|
1053
993
|
*/
|
|
1054
|
-
interface FieldSort<S extends
|
|
994
|
+
interface FieldSort<S extends WQLSpec> {
|
|
1055
995
|
asc(): SortExpression<S>;
|
|
1056
996
|
desc(): SortExpression<S>;
|
|
1057
997
|
}
|
|
@@ -1061,7 +1001,7 @@ interface FieldSort<S extends QuerySpec> {
|
|
|
1061
1001
|
* Filter('price').gt(50)
|
|
1062
1002
|
* Filter.and(Filter('title').eq('Product'), Filter('price').gt(50))
|
|
1063
1003
|
*/
|
|
1064
|
-
interface FilterFactory<T, S extends
|
|
1004
|
+
interface FilterFactory<T, S extends WQLSpec> {
|
|
1065
1005
|
/** Create a field-specific filter */
|
|
1066
1006
|
<Field extends FilterableFields<S>>(field: Field): FieldFilter<T, S, Field>;
|
|
1067
1007
|
/** Combine filters with AND logic */
|
|
@@ -1076,7 +1016,266 @@ interface FilterFactory<T, S extends QuerySpec> {
|
|
|
1076
1016
|
* @example
|
|
1077
1017
|
* Sort('price').desc()
|
|
1078
1018
|
*/
|
|
1079
|
-
type SortFactory<S extends
|
|
1019
|
+
type SortFactory<S extends WQLSpec> = <Field extends SortableFields<S>>(field: Field) => FieldSort<S>;
|
|
1020
|
+
|
|
1021
|
+
/**
|
|
1022
|
+
* The output type from SearchBuilder.build()
|
|
1023
|
+
* This is a plain object ready to be sent to an API
|
|
1024
|
+
*/
|
|
1025
|
+
interface SearchRequest<T, S extends SearchSpec> {
|
|
1026
|
+
/** Filter object */
|
|
1027
|
+
filter?: Filter<T, S>;
|
|
1028
|
+
/** List of sort objects */
|
|
1029
|
+
sort?: Sorting<S>[];
|
|
1030
|
+
/** Full-text search parameters */
|
|
1031
|
+
search?: SearchDetails<S>;
|
|
1032
|
+
/** Aggregations to compute */
|
|
1033
|
+
aggregations?: Aggregation<S>[];
|
|
1034
|
+
/** Paging configuration */
|
|
1035
|
+
paging?: PagingFor<S>;
|
|
1036
|
+
/** Time zone for date operations */
|
|
1037
|
+
timeZone?: string;
|
|
1038
|
+
}
|
|
1039
|
+
/**
|
|
1040
|
+
* Represents a search expression that can be used in SearchBuilder
|
|
1041
|
+
*/
|
|
1042
|
+
interface SearchExpression<S extends SearchSpec> {
|
|
1043
|
+
readonly search: SearchDetails<S>;
|
|
1044
|
+
}
|
|
1045
|
+
/**
|
|
1046
|
+
* Represents an aggregation expression that can be used in SearchBuilder
|
|
1047
|
+
*/
|
|
1048
|
+
interface AggregationExpression<S extends SearchSpec> {
|
|
1049
|
+
readonly aggregation: Aggregation<S>;
|
|
1050
|
+
}
|
|
1051
|
+
/**
|
|
1052
|
+
* Builder for constructing search parameters
|
|
1053
|
+
* @example
|
|
1054
|
+
* SearchParams('dark shoes')
|
|
1055
|
+
* .mode('AND')
|
|
1056
|
+
* .fields(['productName', 'description'])
|
|
1057
|
+
* .fuzzy(true)
|
|
1058
|
+
*/
|
|
1059
|
+
interface SearchParamsBuilder<S extends SearchSpec> extends SearchExpression<S> {
|
|
1060
|
+
/** Set the search expression/query string */
|
|
1061
|
+
expression(expr: string): SearchParamsBuilder<S>;
|
|
1062
|
+
/** Set the search mode (how to combine multiple terms) */
|
|
1063
|
+
mode(mode: 'AND' | 'OR'): SearchParamsBuilder<S>;
|
|
1064
|
+
/** Set the fields to search in */
|
|
1065
|
+
fields(fields: SearchableFields<S>[]): SearchParamsBuilder<S>;
|
|
1066
|
+
/** Enable or disable fuzzy matching */
|
|
1067
|
+
fuzzy(enabled?: boolean): SearchParamsBuilder<S>;
|
|
1068
|
+
}
|
|
1069
|
+
/**
|
|
1070
|
+
* Factory function for creating SearchParamsBuilder
|
|
1071
|
+
* @param expression - Optional search expression to initialize with
|
|
1072
|
+
*/
|
|
1073
|
+
type SearchParamsFactory<S extends SearchSpec> = (expression?: string) => SearchParamsBuilder<S>;
|
|
1074
|
+
/**
|
|
1075
|
+
* Sort configuration for value aggregations
|
|
1076
|
+
*/
|
|
1077
|
+
interface ValueAggregationSort {
|
|
1078
|
+
sortBy(type: 'COUNT' | 'VALUE', direction: 'ASC' | 'DESC'): this;
|
|
1079
|
+
}
|
|
1080
|
+
/**
|
|
1081
|
+
* Builder for VALUE type aggregations
|
|
1082
|
+
*/
|
|
1083
|
+
interface ValueAggregationBuilder<S extends SearchSpec> extends AggregationExpression<S>, ValueAggregationSort {
|
|
1084
|
+
/** Set maximum number of buckets to return */
|
|
1085
|
+
limit(count: number): ValueAggregationBuilder<S>;
|
|
1086
|
+
/** Exclude documents with missing values */
|
|
1087
|
+
excludeMissingValues(): ValueAggregationBuilder<S>;
|
|
1088
|
+
/** Include documents with missing values */
|
|
1089
|
+
includeMissingValues(): ValueAggregationBuilder<S>;
|
|
1090
|
+
/** Include specific values in their own bucket */
|
|
1091
|
+
includeValues(addToBucket: string): ValueAggregationBuilder<S>;
|
|
1092
|
+
}
|
|
1093
|
+
/**
|
|
1094
|
+
* Builder for RANGE type aggregations
|
|
1095
|
+
*/
|
|
1096
|
+
interface RangeAggregationBuilder<S extends SearchSpec> extends AggregationExpression<S> {
|
|
1097
|
+
/** Set the range buckets */
|
|
1098
|
+
withBuckets(...buckets: {
|
|
1099
|
+
from?: number | null;
|
|
1100
|
+
to?: number | null;
|
|
1101
|
+
}[]): RangeAggregationBuilder<S>;
|
|
1102
|
+
}
|
|
1103
|
+
/**
|
|
1104
|
+
* Builder for DATE_HISTOGRAM type aggregations
|
|
1105
|
+
*/
|
|
1106
|
+
interface DateHistogramAggregationBuilder<S extends SearchSpec> extends AggregationExpression<S> {
|
|
1107
|
+
/** Set the interval for date histogram buckets */
|
|
1108
|
+
interval(interval: 'YEAR' | 'MONTH' | 'WEEK' | 'DAY' | 'HOUR' | 'MINUTE' | 'SECOND'): DateHistogramAggregationBuilder<S>;
|
|
1109
|
+
}
|
|
1110
|
+
/**
|
|
1111
|
+
* Builder for SCALAR type aggregations
|
|
1112
|
+
*/
|
|
1113
|
+
interface ScalarAggregationBuilder<S extends SearchSpec> extends AggregationExpression<S> {
|
|
1114
|
+
/** Set the scalar aggregation type */
|
|
1115
|
+
type(scalarType: 'COUNT_DISTINCT' | 'MIN' | 'MAX' | 'SUM' | 'AVG'): ScalarAggregationBuilder<S>;
|
|
1116
|
+
}
|
|
1117
|
+
/**
|
|
1118
|
+
* Builder for NESTED type aggregations
|
|
1119
|
+
*/
|
|
1120
|
+
interface NestedAggregationBuilder<S extends SearchSpec> extends AggregationExpression<S> {
|
|
1121
|
+
/** Add a nested aggregation */
|
|
1122
|
+
addNestedAggregation(aggregation: AggregationExpression<S>): NestedAggregationBuilder<S>;
|
|
1123
|
+
}
|
|
1124
|
+
/**
|
|
1125
|
+
* Aggregation type configuration
|
|
1126
|
+
*/
|
|
1127
|
+
type AggregationType = 'VALUE' | 'RANGE' | 'DATE_HISTOGRAM' | 'SCALAR' | 'NESTED';
|
|
1128
|
+
/**
|
|
1129
|
+
* Builder for constructing aggregations
|
|
1130
|
+
* @example
|
|
1131
|
+
* Aggregation('status_count')
|
|
1132
|
+
* .ofType('VALUE')
|
|
1133
|
+
* .onField('status')
|
|
1134
|
+
* .asValueAggregation()
|
|
1135
|
+
* .sortBy('COUNT', 'DESC')
|
|
1136
|
+
* .limit(10)
|
|
1137
|
+
*/
|
|
1138
|
+
interface AggregationBuilder<S extends SearchSpec> extends AggregationExpression<S> {
|
|
1139
|
+
/** Set the aggregation type */
|
|
1140
|
+
ofType(type: AggregationType): AggregationBuilder<S>;
|
|
1141
|
+
/** Set the field to aggregate on */
|
|
1142
|
+
onField(field: AggregatableFields<S>): AggregationBuilder<S>;
|
|
1143
|
+
/** Configure as a value aggregation */
|
|
1144
|
+
asValueAggregation(): ValueAggregationBuilder<S>;
|
|
1145
|
+
/** Configure as a range aggregation */
|
|
1146
|
+
asRangeAggregation(): RangeAggregationBuilder<S>;
|
|
1147
|
+
/** Configure as a date histogram aggregation */
|
|
1148
|
+
asDateHistogramAggregation(): DateHistogramAggregationBuilder<S>;
|
|
1149
|
+
/** Configure as a scalar aggregation */
|
|
1150
|
+
asScalarAggregation(): ScalarAggregationBuilder<S>;
|
|
1151
|
+
/** Configure as a nested aggregation */
|
|
1152
|
+
asNestedAggregation(): NestedAggregationBuilder<S>;
|
|
1153
|
+
}
|
|
1154
|
+
/**
|
|
1155
|
+
* Factory function for creating AggregationBuilder
|
|
1156
|
+
*/
|
|
1157
|
+
type AggregationFactory<S extends SearchSpec> = (name: string) => AggregationBuilder<S>;
|
|
1158
|
+
/**
|
|
1159
|
+
* Search builder interface for constructing search requests
|
|
1160
|
+
* @template T - Entity type
|
|
1161
|
+
* @template S - Search spec defining filterable/sortable/searchable/aggregatable fields
|
|
1162
|
+
* @template R - Output type from build() (defaults to SearchRequest<T, S>)
|
|
1163
|
+
* @example
|
|
1164
|
+
* SearchBuilder()
|
|
1165
|
+
* .withFilter(Filter.and(
|
|
1166
|
+
* Filter('title').eq('Product'),
|
|
1167
|
+
* Filter('price').gt(50)
|
|
1168
|
+
* ))
|
|
1169
|
+
* .withSearchClause(SearchParams('shoes').fuzzy(true))
|
|
1170
|
+
* .withAggregation(Aggregation('status_count').ofType('VALUE').onField('status'))
|
|
1171
|
+
* .withSorting(Sort('price').desc())
|
|
1172
|
+
* .withPaging({ limit: 20 })
|
|
1173
|
+
* .build()
|
|
1174
|
+
*/
|
|
1175
|
+
interface SearchBuilder<T, S extends SearchSpec, R = SearchRequest<T, S>> {
|
|
1176
|
+
/** Add a filter to the search */
|
|
1177
|
+
withFilter(filter: FilterExpression<T, S>): SearchBuilder<T, S, R>;
|
|
1178
|
+
/** Add a search clause for full-text search */
|
|
1179
|
+
withSearchClause(search: SearchExpression<S>): SearchBuilder<T, S, R>;
|
|
1180
|
+
/** Add sorting to the search */
|
|
1181
|
+
withSorting(...sorts: SortExpression<S>[]): SearchBuilder<T, S, R>;
|
|
1182
|
+
/** Add aggregations to the search */
|
|
1183
|
+
withAggregation(...aggregations: AggregationExpression<S>[]): SearchBuilder<T, S, R>;
|
|
1184
|
+
/** Add paging to the search */
|
|
1185
|
+
withPaging(paging: PagingFor<S>): SearchBuilder<T, S, R>;
|
|
1186
|
+
/** Set the time zone for date operations */
|
|
1187
|
+
withTimeZone(timeZone: string): SearchBuilder<T, S, R>;
|
|
1188
|
+
/** Build the final search request object */
|
|
1189
|
+
build(): R;
|
|
1190
|
+
}
|
|
1191
|
+
/**
|
|
1192
|
+
* Complete set of search helpers for an entity
|
|
1193
|
+
* This is what gets spread into module namespaces
|
|
1194
|
+
* @template T - Entity type
|
|
1195
|
+
* @template S - Search spec defining filterable/sortable/searchable/aggregatable fields
|
|
1196
|
+
* @template R - Output type from SearchBuilder.build() (defaults to SearchRequest<T, S>)
|
|
1197
|
+
*/
|
|
1198
|
+
interface SearchHelpers<T, S extends SearchSpec, R = SearchRequest<T, S>> {
|
|
1199
|
+
/** SearchBuilder factory */
|
|
1200
|
+
SearchBuilder: () => SearchBuilder<T, S, R>;
|
|
1201
|
+
/** Filter factory - creates filter expressions (reused from query) */
|
|
1202
|
+
Filter: FilterFactory<T, S>;
|
|
1203
|
+
/** Sort factory - creates sort expressions (reused from query) */
|
|
1204
|
+
Sort: SortFactory<S>;
|
|
1205
|
+
/** Search params factory - creates search expressions */
|
|
1206
|
+
SearchParams: SearchParamsFactory<S>;
|
|
1207
|
+
/** Aggregation factory - creates aggregation expressions */
|
|
1208
|
+
Aggregation: AggregationFactory<S>;
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
/**
|
|
1212
|
+
* Specification for a query API
|
|
1213
|
+
* Defines what fields can be filtered and sorted
|
|
1214
|
+
* @example
|
|
1215
|
+
* interface MyQuerySpec extends QuerySpec {
|
|
1216
|
+
* wql: [{
|
|
1217
|
+
* operators: ['$eq', '$ne'],
|
|
1218
|
+
* fields: ['id', 'title'],
|
|
1219
|
+
* sort: 'BOTH'
|
|
1220
|
+
* }],
|
|
1221
|
+
* paging: 'offset', // or 'cursor' for cursor-based pagination
|
|
1222
|
+
* };
|
|
1223
|
+
*/
|
|
1224
|
+
interface QuerySpec extends WQLSpec {
|
|
1225
|
+
/**
|
|
1226
|
+
* Supported paging type for this query API
|
|
1227
|
+
* - 'cursor': Uses cursor-based pagination
|
|
1228
|
+
* - 'offset': Uses offset-based pagination
|
|
1229
|
+
*/
|
|
1230
|
+
paging: PagingType;
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
/**
|
|
1234
|
+
* Complete query request for an entity type
|
|
1235
|
+
* @template Entity The entity type being queried
|
|
1236
|
+
* @template Spec The query specification type
|
|
1237
|
+
* @example
|
|
1238
|
+
* // Define a query type for products
|
|
1239
|
+
* type QueryProducts = Query<Product, ProductQuerySpec>;
|
|
1240
|
+
*
|
|
1241
|
+
* // Create a query request with offset paging
|
|
1242
|
+
* const query: QueryProducts = {
|
|
1243
|
+
* filter: { price: { $gte: 10 } },
|
|
1244
|
+
* sort: [{ fieldName: 'price', order: 'ASC' }],
|
|
1245
|
+
* paging: { limit: 20, offset: 0 }
|
|
1246
|
+
* };
|
|
1247
|
+
*
|
|
1248
|
+
* // Or with cursor paging (if spec.paging = 'cursor')
|
|
1249
|
+
* const query: QueryProducts = {
|
|
1250
|
+
* filter: { price: { $gte: 10 } },
|
|
1251
|
+
* sort: [{ fieldName: 'price', order: 'ASC' }],
|
|
1252
|
+
* cursorPaging: { limit: 20, cursor: "..." }
|
|
1253
|
+
* };
|
|
1254
|
+
*/
|
|
1255
|
+
type Query<Entity, Spec extends QuerySpec> = {
|
|
1256
|
+
/**
|
|
1257
|
+
* Filter object.
|
|
1258
|
+
* Learn more about the [filter section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-filter-section).
|
|
1259
|
+
*/
|
|
1260
|
+
filter?: Filter<Entity, Spec>;
|
|
1261
|
+
/**
|
|
1262
|
+
* List of sort objects.
|
|
1263
|
+
* Learn more about the [sort section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-sort-section).
|
|
1264
|
+
*/
|
|
1265
|
+
sort?: Sorting<Spec>[];
|
|
1266
|
+
} & Partial<Paging<Spec>>;
|
|
1267
|
+
|
|
1268
|
+
/**
|
|
1269
|
+
* The output type from QueryBuilder.build()
|
|
1270
|
+
* This is a plain object ready to be sent to an API
|
|
1271
|
+
*/
|
|
1272
|
+
interface QueryRequest<T, S extends QuerySpec> {
|
|
1273
|
+
filter?: Filter<T, S>;
|
|
1274
|
+
sort?: Sorting<S>[];
|
|
1275
|
+
paging?: PagingFor<S>;
|
|
1276
|
+
/** Field projection - return only specified fields */
|
|
1277
|
+
fields?: string[];
|
|
1278
|
+
}
|
|
1080
1279
|
/**
|
|
1081
1280
|
* Query builder interface
|
|
1082
1281
|
* @template T - Entity type
|
|
@@ -1121,4 +1320,4 @@ interface QueryHelpers<T, S extends QuerySpec, R = QueryRequest<T, S>> {
|
|
|
1121
1320
|
Sort: SortFactory<S>;
|
|
1122
1321
|
}
|
|
1123
1322
|
|
|
1124
|
-
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 };
|
|
1323
|
+
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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/sdk-types",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.5",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Ronny Ringel",
|
|
6
6
|
"email": "ronnyr@wix.com"
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
]
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
|
-
"falconPackageHash": "
|
|
65
|
+
"falconPackageHash": "db830ffd08e27bb7db1c480c3f9ec43b0988a139aafd5fd7da849047"
|
|
66
66
|
}
|