@wix/wix-data-items-common 1.0.52

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.
Files changed (228) hide show
  1. package/README.md +8 -0
  2. package/dist/cjs/api/ApiClient.js +186 -0
  3. package/dist/cjs/api/ApiClient.js.map +1 -0
  4. package/dist/cjs/api/QueryBase.js +200 -0
  5. package/dist/cjs/api/QueryBase.js.map +1 -0
  6. package/dist/cjs/api/QueryValidator.js +36 -0
  7. package/dist/cjs/api/QueryValidator.js.map +1 -0
  8. package/dist/cjs/api/WixDataAggregate.js +4 -0
  9. package/dist/cjs/api/WixDataAggregate.js.map +1 -0
  10. package/dist/cjs/api/WixDataApi.js +800 -0
  11. package/dist/cjs/api/WixDataApi.js.map +1 -0
  12. package/dist/cjs/api/WixDataFilter.js +2 -0
  13. package/dist/cjs/api/WixDataFilter.js.map +1 -0
  14. package/dist/cjs/api/WixDataPatch.js +139 -0
  15. package/dist/cjs/api/WixDataPatch.js.map +1 -0
  16. package/dist/cjs/api/WixDataQuery.js +4 -0
  17. package/dist/cjs/api/WixDataQuery.js.map +1 -0
  18. package/dist/cjs/api/WixDataResult.js +4 -0
  19. package/dist/cjs/api/WixDataResult.js.map +1 -0
  20. package/dist/cjs/api/common.js +14 -0
  21. package/dist/cjs/api/common.js.map +1 -0
  22. package/dist/cjs/api/errors.js +67 -0
  23. package/dist/cjs/api/errors.js.map +1 -0
  24. package/dist/cjs/api/impl/WixDataAggregateImpl.js +193 -0
  25. package/dist/cjs/api/impl/WixDataAggregateImpl.js.map +1 -0
  26. package/dist/cjs/api/impl/WixDataQueryImpl.js +116 -0
  27. package/dist/cjs/api/impl/WixDataQueryImpl.js.map +1 -0
  28. package/dist/cjs/api/impl/WixDataResultImpl.js +111 -0
  29. package/dist/cjs/api/impl/WixDataResultImpl.js.map +1 -0
  30. package/dist/cjs/api/index.js +32 -0
  31. package/dist/cjs/api/index.js.map +1 -0
  32. package/dist/cjs/api/types.js +2 -0
  33. package/dist/cjs/api/types.js.map +1 -0
  34. package/dist/cjs/errors/base-validator.js +92 -0
  35. package/dist/cjs/errors/base-validator.js.map +1 -0
  36. package/dist/cjs/errors/errors.js +155 -0
  37. package/dist/cjs/errors/errors.js.map +1 -0
  38. package/dist/cjs/errors/index.js +15 -0
  39. package/dist/cjs/errors/index.js.map +1 -0
  40. package/dist/cjs/errors/validations.js +91 -0
  41. package/dist/cjs/errors/validations.js.map +1 -0
  42. package/dist/cjs/external-types.d.js +2 -0
  43. package/dist/cjs/external-types.d.js.map +1 -0
  44. package/dist/cjs/filter/FilterTree.js +154 -0
  45. package/dist/cjs/filter/FilterTree.js.map +1 -0
  46. package/dist/cjs/filter/WithFilter.js +2 -0
  47. package/dist/cjs/filter/WithFilter.js.map +1 -0
  48. package/dist/cjs/filter/filterBuilder.js +53 -0
  49. package/dist/cjs/filter/filterBuilder.js.map +1 -0
  50. package/dist/cjs/filter/filterMixin.js +144 -0
  51. package/dist/cjs/filter/filterMixin.js.map +1 -0
  52. package/dist/cjs/filter/index.js +16 -0
  53. package/dist/cjs/filter/index.js.map +1 -0
  54. package/dist/cjs/index.js +120 -0
  55. package/dist/cjs/index.js.map +1 -0
  56. package/dist/cjs/sort/sortMixin.js +79 -0
  57. package/dist/cjs/sort/sortMixin.js.map +1 -0
  58. package/dist/cjs/test-types.d.js +2 -0
  59. package/dist/cjs/test-types.d.js.map +1 -0
  60. package/dist/cjs/types/api.js +4 -0
  61. package/dist/cjs/types/api.js.map +1 -0
  62. package/dist/cjs/types/data-item-types.js +46 -0
  63. package/dist/cjs/types/data-item-types.js.map +1 -0
  64. package/dist/cjs/types/error.js +2 -0
  65. package/dist/cjs/types/error.js.map +1 -0
  66. package/dist/cjs/types/index.js +16 -0
  67. package/dist/cjs/types/index.js.map +1 -0
  68. package/dist/cjs/utils/base64url.js +51 -0
  69. package/dist/cjs/utils/base64url.js.map +1 -0
  70. package/dist/cjs/utils/clone.js +21 -0
  71. package/dist/cjs/utils/clone.js.map +1 -0
  72. package/dist/cjs/utils/codec.js +64 -0
  73. package/dist/cjs/utils/codec.js.map +1 -0
  74. package/dist/cjs/utils/field-key-utils.js +18 -0
  75. package/dist/cjs/utils/field-key-utils.js.map +1 -0
  76. package/dist/cjs/utils/index.js +25 -0
  77. package/dist/cjs/utils/index.js.map +1 -0
  78. package/dist/cjs/utils/type-utils.js +54 -0
  79. package/dist/cjs/utils/type-utils.js.map +1 -0
  80. package/dist/esm/api/ApiClient.js +174 -0
  81. package/dist/esm/api/ApiClient.js.map +1 -0
  82. package/dist/esm/api/QueryBase.js +117 -0
  83. package/dist/esm/api/QueryBase.js.map +1 -0
  84. package/dist/esm/api/QueryValidator.js +32 -0
  85. package/dist/esm/api/QueryValidator.js.map +1 -0
  86. package/dist/esm/api/WixDataAggregate.js +2 -0
  87. package/dist/esm/api/WixDataAggregate.js.map +1 -0
  88. package/dist/esm/api/WixDataApi.js +829 -0
  89. package/dist/esm/api/WixDataApi.js.map +1 -0
  90. package/dist/esm/api/WixDataFilter.js +2 -0
  91. package/dist/esm/api/WixDataFilter.js.map +1 -0
  92. package/dist/esm/api/WixDataPatch.js +134 -0
  93. package/dist/esm/api/WixDataPatch.js.map +1 -0
  94. package/dist/esm/api/WixDataQuery.js +2 -0
  95. package/dist/esm/api/WixDataQuery.js.map +1 -0
  96. package/dist/esm/api/WixDataResult.js +2 -0
  97. package/dist/esm/api/WixDataResult.js.map +1 -0
  98. package/dist/esm/api/common.js +10 -0
  99. package/dist/esm/api/common.js.map +1 -0
  100. package/dist/esm/api/errors.js +52 -0
  101. package/dist/esm/api/errors.js.map +1 -0
  102. package/dist/esm/api/impl/WixDataAggregateImpl.js +214 -0
  103. package/dist/esm/api/impl/WixDataAggregateImpl.js.map +1 -0
  104. package/dist/esm/api/impl/WixDataQueryImpl.js +119 -0
  105. package/dist/esm/api/impl/WixDataQueryImpl.js.map +1 -0
  106. package/dist/esm/api/impl/WixDataResultImpl.js +100 -0
  107. package/dist/esm/api/impl/WixDataResultImpl.js.map +1 -0
  108. package/dist/esm/api/index.js +5 -0
  109. package/dist/esm/api/index.js.map +1 -0
  110. package/dist/esm/api/types.js +2 -0
  111. package/dist/esm/api/types.js.map +1 -0
  112. package/dist/esm/errors/base-validator.js +71 -0
  113. package/dist/esm/errors/base-validator.js.map +1 -0
  114. package/dist/esm/errors/errors.js +147 -0
  115. package/dist/esm/errors/errors.js.map +1 -0
  116. package/dist/esm/errors/index.js +5 -0
  117. package/dist/esm/errors/index.js.map +1 -0
  118. package/dist/esm/errors/validations.js +114 -0
  119. package/dist/esm/errors/validations.js.map +1 -0
  120. package/dist/esm/filter/FilterTree.js +148 -0
  121. package/dist/esm/filter/FilterTree.js.map +1 -0
  122. package/dist/esm/filter/WithFilter.js +2 -0
  123. package/dist/esm/filter/WithFilter.js.map +1 -0
  124. package/dist/esm/filter/filterBuilder.js +43 -0
  125. package/dist/esm/filter/filterBuilder.js.map +1 -0
  126. package/dist/esm/filter/filterMixin.js +137 -0
  127. package/dist/esm/filter/filterMixin.js.map +1 -0
  128. package/dist/esm/filter/index.js +5 -0
  129. package/dist/esm/filter/index.js.map +1 -0
  130. package/dist/esm/index.js +9 -0
  131. package/dist/esm/index.js.map +1 -0
  132. package/dist/esm/sort/sortMixin.js +74 -0
  133. package/dist/esm/sort/sortMixin.js.map +1 -0
  134. package/dist/esm/types/api.js +2 -0
  135. package/dist/esm/types/api.js.map +1 -0
  136. package/dist/esm/types/data-item-types.js +35 -0
  137. package/dist/esm/types/data-item-types.js.map +1 -0
  138. package/dist/esm/types/error.js +2 -0
  139. package/dist/esm/types/error.js.map +1 -0
  140. package/dist/esm/types/index.js +3 -0
  141. package/dist/esm/types/index.js.map +1 -0
  142. package/dist/esm/utils/base64url.js +57 -0
  143. package/dist/esm/utils/base64url.js.map +1 -0
  144. package/dist/esm/utils/clone.js +18 -0
  145. package/dist/esm/utils/clone.js.map +1 -0
  146. package/dist/esm/utils/codec.js +60 -0
  147. package/dist/esm/utils/codec.js.map +1 -0
  148. package/dist/esm/utils/field-key-utils.js +14 -0
  149. package/dist/esm/utils/field-key-utils.js.map +1 -0
  150. package/dist/esm/utils/index.js +7 -0
  151. package/dist/esm/utils/index.js.map +1 -0
  152. package/dist/esm/utils/type-utils.js +40 -0
  153. package/dist/esm/utils/type-utils.js.map +1 -0
  154. package/dist/types/api/ApiClient.d.ts +30 -0
  155. package/dist/types/api/ApiClient.d.ts.map +1 -0
  156. package/dist/types/api/QueryBase.d.ts +111 -0
  157. package/dist/types/api/QueryBase.d.ts.map +1 -0
  158. package/dist/types/api/QueryValidator.d.ts +12 -0
  159. package/dist/types/api/QueryValidator.d.ts.map +1 -0
  160. package/dist/types/api/WixDataAggregate.d.ts +320 -0
  161. package/dist/types/api/WixDataAggregate.d.ts.map +1 -0
  162. package/dist/types/api/WixDataApi.d.ts +52 -0
  163. package/dist/types/api/WixDataApi.d.ts.map +1 -0
  164. package/dist/types/api/WixDataFilter.d.ts +424 -0
  165. package/dist/types/api/WixDataFilter.d.ts.map +1 -0
  166. package/dist/types/api/WixDataPatch.d.ts +80 -0
  167. package/dist/types/api/WixDataPatch.d.ts.map +1 -0
  168. package/dist/types/api/WixDataQuery.d.ts +702 -0
  169. package/dist/types/api/WixDataQuery.d.ts.map +1 -0
  170. package/dist/types/api/WixDataResult.d.ts +144 -0
  171. package/dist/types/api/WixDataResult.d.ts.map +1 -0
  172. package/dist/types/api/common.d.ts +3 -0
  173. package/dist/types/api/common.d.ts.map +1 -0
  174. package/dist/types/api/errors.d.ts +12 -0
  175. package/dist/types/api/errors.d.ts.map +1 -0
  176. package/dist/types/api/impl/WixDataAggregateImpl.d.ts +76 -0
  177. package/dist/types/api/impl/WixDataAggregateImpl.d.ts.map +1 -0
  178. package/dist/types/api/impl/WixDataQueryImpl.d.ts +72 -0
  179. package/dist/types/api/impl/WixDataQueryImpl.d.ts.map +1 -0
  180. package/dist/types/api/impl/WixDataResultImpl.d.ts +34 -0
  181. package/dist/types/api/impl/WixDataResultImpl.d.ts.map +1 -0
  182. package/dist/types/api/index.d.ts +11 -0
  183. package/dist/types/api/index.d.ts.map +1 -0
  184. package/dist/types/api/types.d.ts +163 -0
  185. package/dist/types/api/types.d.ts.map +1 -0
  186. package/dist/types/errors/base-validator.d.ts +28 -0
  187. package/dist/types/errors/base-validator.d.ts.map +1 -0
  188. package/dist/types/errors/errors.d.ts +108 -0
  189. package/dist/types/errors/errors.d.ts.map +1 -0
  190. package/dist/types/errors/index.d.ts +5 -0
  191. package/dist/types/errors/index.d.ts.map +1 -0
  192. package/dist/types/errors/validations.d.ts +25 -0
  193. package/dist/types/errors/validations.d.ts.map +1 -0
  194. package/dist/types/filter/FilterTree.d.ts +56 -0
  195. package/dist/types/filter/FilterTree.d.ts.map +1 -0
  196. package/dist/types/filter/WithFilter.d.ts +470 -0
  197. package/dist/types/filter/WithFilter.d.ts.map +1 -0
  198. package/dist/types/filter/filterBuilder.d.ts +105 -0
  199. package/dist/types/filter/filterBuilder.d.ts.map +1 -0
  200. package/dist/types/filter/filterMixin.d.ts +61 -0
  201. package/dist/types/filter/filterMixin.d.ts.map +1 -0
  202. package/dist/types/filter/index.d.ts +8 -0
  203. package/dist/types/filter/index.d.ts.map +1 -0
  204. package/dist/types/index.d.ts +13 -0
  205. package/dist/types/index.d.ts.map +1 -0
  206. package/dist/types/sort/sortMixin.d.ts +46 -0
  207. package/dist/types/sort/sortMixin.d.ts.map +1 -0
  208. package/dist/types/types/api.d.ts +36 -0
  209. package/dist/types/types/api.d.ts.map +1 -0
  210. package/dist/types/types/data-item-types.d.ts +1448 -0
  211. package/dist/types/types/data-item-types.d.ts.map +1 -0
  212. package/dist/types/types/error.d.ts +23 -0
  213. package/dist/types/types/error.d.ts.map +1 -0
  214. package/dist/types/types/index.d.ts +4 -0
  215. package/dist/types/types/index.d.ts.map +1 -0
  216. package/dist/types/utils/base64url.d.ts +2 -0
  217. package/dist/types/utils/base64url.d.ts.map +1 -0
  218. package/dist/types/utils/clone.d.ts +2 -0
  219. package/dist/types/utils/clone.d.ts.map +1 -0
  220. package/dist/types/utils/codec.d.ts +3 -0
  221. package/dist/types/utils/codec.d.ts.map +1 -0
  222. package/dist/types/utils/field-key-utils.d.ts +2 -0
  223. package/dist/types/utils/field-key-utils.d.ts.map +1 -0
  224. package/dist/types/utils/index.d.ts +7 -0
  225. package/dist/types/utils/index.d.ts.map +1 -0
  226. package/dist/types/utils/type-utils.d.ts +11 -0
  227. package/dist/types/utils/type-utils.d.ts.map +1 -0
  228. package/package.json +89 -0
@@ -0,0 +1,702 @@
1
+ import { WixDataQueryOptions, WixDataReadOptions } from './types';
2
+ import { WixDataResult } from './WixDataResult';
3
+ import { WixDataFilter } from './WixDataFilter';
4
+ type Comparable = string | number | Date;
5
+ /**
6
+ * @builder
7
+ */
8
+ export interface WixDataQuery {
9
+ /**
10
+ * Adds a sort to a query or sort, sorting by the specified properties in descending order.
11
+ *
12
+ * The `descending()` function refines this query to sort in descending order of the specified properties. If you
13
+ * specify more than one property, descending() sorts the results in descending order by each property in the order
14
+ * they are listed.
15
+ *
16
+ * You can sort the following types:
17
+ *
18
+ * Number: Sorts numerically.
19
+ * - Date: Sorts by date and time.
20
+ * - String: Sorts lexicographically, so `"abc"` comes before `"XYZ"`.
21
+ * - Reference: Compares by the ID of the referenced item as a String.
22
+ *
23
+ * If a property contains a number as a String, that value will be sorted alphabetically and not numerically. Items
24
+ * that do not have a value for the specified sort property are ranked lowest.
25
+ * @public
26
+ * @documentationMaturity preview
27
+ * @param fields - The properties used in the sort.
28
+ * @requiredField fields
29
+ * @returns An object representing the refined query.
30
+ */
31
+ descending(...fields: string[]): WixDataQuery;
32
+ descending(fields: string[]): WixDataQuery;
33
+ descending(...fields: any): WixDataQuery;
34
+ /**
35
+ * Adds a sort to a query or sort, sorting by the specified properties in ascending order.
36
+ *
37
+ * The `ascending()` function refines this query in ascending order of the specified properties. If you specify more
38
+ * than one property, ascending() sorts the results in ascending order by each property in the order they are listed.
39
+ *
40
+ * You can sort the following types:
41
+ * - Number: Sorts numerically.
42
+ * - Date: Sorts by date and time.
43
+ * - String: Sorts lexicographically, so `"abc"` comes after `"XYZ"`.
44
+ * - Reference: Compares by the ID of the referenced item as a String.
45
+ *
46
+ * If a property contains a number as a String, that value will be sorted alphabetically and not numerically.
47
+ * Items that do not have a value for the specified sort property are ranked lowest.
48
+ * @public
49
+ * @documentationMaturity preview
50
+ * @param fields - The properties used in the sort.
51
+ * @requiredField fields
52
+ * @returns An object representing the refined query.
53
+ */
54
+ ascending(...fields: string[]): WixDataQuery;
55
+ ascending(fields: string[]): WixDataQuery;
56
+ ascending(...fields: any): WixDataQuery;
57
+ /**
58
+ * Refines a query to match items whose specified property value equals the specified value.
59
+ *
60
+ * The `eq()` function refines this query to only
61
+ * match items where the value of the specified property equals the specified `value`.
62
+ *
63
+ * It only matches values of the same type. For example, a number value stored
64
+ * as a String type does not match the same number stored as a Number type.
65
+ *
66
+ * Matching strings with `eq()` is case sensitive, so `"text"` is not equal to `"Text"`.
67
+ *
68
+ * If `field` points to a collection field of type Array, `eq()` includes the item
69
+ * as long as at least one Array element matches the specified `value`.
70
+ * @public
71
+ * @documentationMaturity preview
72
+ * @param field - The property whose value will be compared with `value`.
73
+ * @requiredField field
74
+ * @param value - The value to match against.
75
+ * @requiredField value
76
+ * @returns An object representing the refined query.
77
+ */
78
+ eq(field: string, value: any): WixDataQuery;
79
+ /**
80
+ * Refines a query to match items whose specified property value does not equal the specified value.
81
+ *
82
+ * The `ne()` function refines this query to only
83
+ * match items where the value of the specified property does not equal the specified `value`.
84
+ *
85
+ * It only matches values of the same type. For example, a number value stored
86
+ * as a String type is considered not equal to the same number stored as a Number type.
87
+ *
88
+ * Matching strings with `ne()` is case sensitive, so `"text"` is not equal to `"Text"`.
89
+ *
90
+ * If the value of the `field` property is an Array, `ne()` includes items
91
+ * in which none of the elements of the Array match the specified `value`.
92
+ * @public
93
+ * @documentationMaturity preview
94
+ * @param field - The property whose value will be compared with `value`.
95
+ * @requiredField field
96
+ * @param value - The value to match against.
97
+ * @requiredField value
98
+ * @returns An object representing the refined query.
99
+ */
100
+ ne(field: string, value: any): WixDataQuery;
101
+ /**
102
+ * Refines a query to match items whose specified property value is greater than or equal to the specified
103
+ * value.
104
+ *
105
+ * The `ge()` function refines this query to only
106
+ * match items where the value of the specified property is greater than or
107
+ * equal to the specified `value`.
108
+ *
109
+ * It only matches values of the same type. For example, a number value stored
110
+ * as a String type does not match the same number stored as a Number type.
111
+ *
112
+ * If a property contains a number as a String, that value will be compared
113
+ * alphabetically and not numerically. Items that do not have a value for the
114
+ * specified property are ranked lowest.
115
+ *
116
+ * The following types of properties can be compared:
117
+ * - Number: Compares numerically.
118
+ * - Date: Compares JavaScript Date objects.
119
+ * - String: Compares lexicographically,
120
+ * so `"abc"` is greater than or equal to `"ABC"` (because of the greater than),
121
+ * but `"ABC"` is not greater than or equal to `"abc"`.
122
+ * - Reference: Compares by the ID of the referenced item as a String.
123
+ * @public
124
+ * @documentationMaturity preview
125
+ * @param field - The property whose value will be compared with `value`.
126
+ * @requiredField field
127
+ * @param value - The value to match against.
128
+ * @requiredField value
129
+ * @returns An object representing the refined query.
130
+ */
131
+ ge(field: string, value: Comparable): WixDataQuery;
132
+ /**
133
+ * Refines a query to match items whose specified property value is greater than the specified value.
134
+ *
135
+ * The `gt()` function refines this query to only match
136
+ * items where the value of the specified property is greater than the specified `value`.
137
+ *
138
+ * It only matches values of the same type. For example, a number value stored
139
+ * as a String type does not match the same number stored as a Number type.
140
+ *
141
+ * If a property contains a number as a String, that value will be compared
142
+ * alphabetically and not numerically. Items that do not have a value for the
143
+ * specified property are ranked lowest.
144
+ *
145
+ * The following types of properties can be compared:
146
+ * - Number: Compares numerically.
147
+ * - Date: Compares JavaScript Date objects.
148
+ * - String: Compares lexicographically, so `"text"` is greater than `"Text"`.
149
+ * - Reference: Compares by the ID of the referenced item as a String.
150
+ * @public
151
+ * @documentationMaturity preview
152
+ * @param field - The property whose value will be compared with `value`.
153
+ * @requiredField field
154
+ * @param value - The value to match against.
155
+ * @requiredField value
156
+ * @returns An object with the query definition, based on the supplied parameters.
157
+ */
158
+ gt(field: string, value: Comparable): WixDataQuery;
159
+ /**
160
+ * Refines a query to match items whose specified property value is less than or equal to the specified
161
+ * value.
162
+ *
163
+ * The `le()` function refines this query to only match
164
+ * items where the value of the specified property is less than or equal to the
165
+ * specified `value`.
166
+ *
167
+ * It only matches values of the same type. For example, a number value stored
168
+ * as a String type does not match the same number stored as a Number type.
169
+ *
170
+ * If a property contains a number as a String, that value will be compared
171
+ * alphabetically and not numerically. Items that do not have a value for the
172
+ * specified property are ranked lowest.
173
+ *
174
+ * The following types of properties can be compared:
175
+ * - Number: Compares numerically.
176
+ * - Date: Compares JavaScript Date objects.
177
+ * - String: Compares lexicographically,
178
+ * so `"ABC"` is less than or equal to `"abc"` (because of the less than),
179
+ * but `"abc"` is not less than or equal to `"ABC"`.
180
+ * - Reference: Compares by the ID of the referenced item as a String.
181
+ * @public
182
+ * @documentationMaturity preview
183
+ * @param field - The property whose value will be compared with `value`.
184
+ * @requiredField field
185
+ * @param value - The value to match against.
186
+ * @requiredField value
187
+ * @returns An object representing the refined query.
188
+ */
189
+ le(field: string, value: Comparable): WixDataQuery;
190
+ /**
191
+ * Refines a query to match items whose specified property value is less than the specified value.
192
+ *
193
+ * The `lt()` function refines this query to only match
194
+ * items where the value of the specified property is less than the specified `value`.
195
+ *
196
+ * It only matches values of the same type. For example, a number value stored
197
+ * as a String type does not match the same number stored as a Number type.
198
+ *
199
+ * If a property contains a number as a String, that value will be compared
200
+ * alphabetically and not numerically. Items that do not have a value for the
201
+ * specified property are ranked lowest.
202
+ *
203
+ * The following types of properties can be compared:
204
+ * - Number: Compares numerically.
205
+ * - Date: Compares JavaScript Date objects.
206
+ * - String: Compares lexicographically, so `"Text"` is less than `"text"`.
207
+ * - Reference: Compares by the ID of the referenced item as a String.
208
+ * @public
209
+ * @documentationMaturity preview
210
+ * @param field - The property whose value will be compared with `value`.
211
+ * @requiredField field
212
+ * @param value - The value to match against.
213
+ * @requiredField value
214
+ * @returns An object with the query definition, based on the supplied parameters.
215
+ */
216
+ lt(field: string, value: Comparable): WixDataQuery;
217
+ /**
218
+ * Refines a query to match items whose specified property has any value.
219
+ *
220
+ * The `isNotEmpty()` function refines this query to only match items where the
221
+ * value of the specified property is not `null` or `undefined`.
222
+ *
223
+ * If the property contains any value at all for a given item, including the
224
+ * empty string or an invalid value, that item will match the query.
225
+ * @public
226
+ * @documentationMaturity preview
227
+ * @param field - The property in which to check for a value.
228
+ * @requiredField field
229
+ * @returns An object representing the refined query.
230
+ */
231
+ isNotEmpty(field: string): WixDataQuery;
232
+ /**
233
+ * Refines a query to match items whose specified property does not exist or does not have any value.
234
+ *
235
+ * The `isEmpty()` function refines this query to only match items where the
236
+ * value of the specified property is `null` or `undefined` or the property does
237
+ * not exist.
238
+ *
239
+ * If the property contains any value at all for a given item, including the
240
+ * empty string or an invalid value, that item will match the query.
241
+ * @public
242
+ * @documentationMaturity preview
243
+ * @param field - The property in which to check for a value.
244
+ * @requiredField field
245
+ * @returns An object representing the refined query.
246
+ */
247
+ isEmpty(field: string): WixDataQuery;
248
+ /**
249
+ * Refines a query to match items whose specified property value starts with a specified string.
250
+ *
251
+ * The `startsWith()` function refines this query to
252
+ * only match items where the value of the specified property starts with the
253
+ * defined `string`. Matching with `startsWith()` is not case sensitive, so `"TEXT"` starts
254
+ * with `"tex"`.
255
+ *
256
+ * You can only use `startsWith()` with a property whose value is a String or Reference.
257
+ * When using a Reference, `startsWith()` matches by the ID of the referenced item as Strings.
258
+ * @public
259
+ * @documentationMaturity preview
260
+ * @param field - The property whose value will be compared with the `value` parameter.
261
+ * @requiredField field
262
+ * @param value - The string to look for at the beginning of the specified property value.
263
+ * @requiredField value
264
+ * @returns A `WixDataQuery` object representing the refined query.
265
+ */
266
+ startsWith(field: string, value: string): WixDataQuery;
267
+ /**
268
+ * Refines a query to match items whose specified property value ends with a specified string.
269
+ *
270
+ * The `endsWith()` function refines this query to only
271
+ * match items where the value of the specified property ends with the specified
272
+ * `string`. Matching with `endsWith()` is not case sensitive, so `"TEXT"` ends
273
+ * with `"ext"`.
274
+ *
275
+ * You can only use `endsWith()` with a property whose value is a String or Reference.
276
+ * When using a Reference, `endsWith()` matches by the ID of the referenced item as Strings.
277
+ * @public
278
+ * @documentationMaturity preview
279
+ * @param field - The property whose value will be compared with the string.
280
+ * @requiredField field
281
+ * @param value - The string to look for at the end of the specified property value.
282
+ * @requiredField value
283
+ * @returns A `WixDataQuery` object representing the refined query.
284
+ */
285
+ endsWith(field: string, value: string): WixDataQuery;
286
+ /**
287
+ * Refines a query to match items whose specified property value contains a specified string.
288
+ *
289
+ * The `contains()` function refines this query to
290
+ * only match items where the value of the specified property contains the
291
+ * specified `string`. Matching with `contains()` is not case sensitive, so
292
+ * `"text"` does contain `"Tex"`.
293
+ *
294
+ * You can use `contains()` with a property whose value is a String or a Reference.
295
+ * For properties of type reference it is recommended that you use the [`eq()`](#eq)
296
+ * function instead of `contains()`. With properties that are References, `contains()`
297
+ * matches by the ID of the referenced item as a String.
298
+ * @public
299
+ * @documentationMaturity preview
300
+ * @param field - The property whose value will be compared with the string.
301
+ * @requiredField field
302
+ * @param value - The string to look for inside the specified property value.
303
+ * @requiredField value
304
+ * @returns An object representing the refined query.
305
+ */
306
+ contains(field: string, value: string): WixDataQuery;
307
+ /**
308
+ * Refines a query to match items whose specified property value equals any of the specified `values`
309
+ * parameters.
310
+ *
311
+ * The `hasSome()` function refines this query to
312
+ * only match items where the value of the specified property equals any of
313
+ * the specified values.
314
+ *
315
+ * Matching strings with `hasSome()` is case sensitive, so `"text"` is not equal to `"Text"`.
316
+ *
317
+ * If the value of the specified property is an array, `hasSome()` will match
318
+ * if any of the elements of that array match any of the specified values.
319
+ *
320
+ * If the specified property contains multiple references, pass item IDs in the
321
+ * `value` property. In such a case, `hasSome()` will match if any of the
322
+ * multiple references match any of the specified ID values.
323
+ *
324
+ * You can specify a list of values to match by providing an array of
325
+ * String, Number, or Date types as the `value` parameters.
326
+ * @public
327
+ * @documentationMaturity preview
328
+ * @param field - The property whose value will be compared with `value`.
329
+ * @requiredField field
330
+ * @param values - The values to match against.
331
+ * @requiredField values
332
+ * @returns An object representing the refined query.
333
+ */
334
+ hasSome(field: string, ...values: Comparable[]): WixDataQuery;
335
+ /**
336
+ * Overload for `hasSome()`
337
+ * @public
338
+ * @documentationMaturity preview
339
+ */
340
+ hasSome(field: string, values: Comparable[]): WixDataQuery;
341
+ /**
342
+ * Refines a query to match items whose specified property values equals all of the specified `value`
343
+ * parameters.
344
+ *
345
+ * The `hasAll()` function refines this query to
346
+ * only match items where the value of the specified property equals all of
347
+ * the specified values.
348
+ *
349
+ * Matching strings with `hasAll()` is case sensitive, so `"text"` is not equal to `"Text"`.
350
+ *
351
+ * If the value of the specified property is an array, `hasAll()` will match
352
+ * if there is a match in the elements of that array for all of the specified
353
+ * values.
354
+ *
355
+ * You can specify a list of values to match by providing an array of
356
+ * String, Number, or Date types as the `value` parameters.
357
+ * @public
358
+ * @documentationMaturity preview
359
+ * @param field - The property whose value will be compared with `value`.
360
+ * @requiredField field
361
+ * @param values - The values to match against.
362
+ * @requiredField values
363
+ * @returns An object representing the refined query.
364
+ */
365
+ hasAll(field: string, ...values: Comparable[]): WixDataQuery;
366
+ /**
367
+ * Overload for `hasAll()`
368
+ * @public
369
+ * @documentationMaturity preview
370
+ */
371
+ hasAll(field: string, values: Comparable[]): WixDataQuery;
372
+ /**
373
+ * Adds an `or` condition to the query or filter.
374
+ *
375
+ * The `or()` function adds an inclusive `or` condition to this filter. A query or filter
376
+ * with an `or` returns all the items that match the query or filter as defined up to
377
+ * the `or` function, the items that match the query or filter passed to the `or`
378
+ * function, and the items that match both.
379
+ *
380
+ * The 'or()' function is designed to work with 2 or more queries or filters.
381
+ * If you use it on its own, it will return all the items in a collection.
382
+ * @public
383
+ * @documentationMaturity preview
384
+ * @param filter - A filter to add to the initial filter as an `or` condition.
385
+ * @requiredField filter
386
+ * @returns An object representing the refined query.
387
+ */
388
+ or(filter: WixDataFilter): WixDataQuery;
389
+ /**
390
+ * Adds an `and` condition to the query or filter.
391
+ *
392
+ * The `and()` function adds an and condition to this query. A query or filter with an `and` returns all the items
393
+ * that match the query or filter as defined up to the `and` function and also match the query or filter passed to
394
+ * the `and` function.
395
+ *
396
+ * Note that when chaining multiple `WixDataFilter` functions to a query an and condition is assumed. In such cases,
397
+ * you do not need to add a call to the `and()` function. For example, this query returns results where status is
398
+ * active **and** age is greater than 25.
399
+ * ```js
400
+ * wixClient.items.query("myCollection").eq("status", "active").gt("age", 25);
401
+ * ```
402
+ *
403
+ * The `and()` function is needed when performing compound queries. For example, the final query in this set of
404
+ * queries returns results where status is either pending or rejected **and** age is either less than 25 or greater
405
+ * than 65.
406
+ * ```js
407
+ * let statusQuery = wixClient.items
408
+ * .query("myCollection")
409
+ * .eq("status", "pending")
410
+ * .or(wixClient.items.filter().eq("status", "rejected"));
411
+ *
412
+ * let ageQuery = wixClient.items
413
+ * .filter()
414
+ * .lt("age", 25)
415
+ * .or(wixClient.items.filter().gt("age", 65));
416
+ *
417
+ * let statusAndAgeQuery = statusQuery.and(ageQuery);
418
+ * ```
419
+ *
420
+ * The `and()` function is designed to work with 2 or more queries or filters. If you use it on its own, it will
421
+ * return all the items in a collection.
422
+ * @public
423
+ * @documentationMaturity preview
424
+ * @param filter - A filter to add to the initial query as an `and` condition.
425
+ * @requiredField filter
426
+ * @returns An object representing the refined query.
427
+ */
428
+ and(filter: WixDataFilter): WixDataQuery;
429
+ /**
430
+ * Adds a `not` condition to the query or filter.
431
+ *
432
+ * The `not()` function adds a `not` condition to this query. A query with a `not`
433
+ * returns all the items that match the query as defined up to the `not`
434
+ * function, but don't match the filter passed to the `not` function.
435
+ *
436
+ * If the query only contains a `not()` function, it returns all the items
437
+ * that don't match the filter defined by the `not` method.
438
+ *
439
+ * @public
440
+ * @documentationMaturity preview
441
+ * @param filter - A filter to add to the initial filter as a `not` condition.
442
+ * @requiredField filter
443
+ * @returns An object representing the refined query.
444
+ */
445
+ not(filter: WixDataFilter): WixDataQuery;
446
+ /**
447
+ * Refines a query to match items whose specified property value is within a specified range.
448
+ *
449
+ * The `between()` function refines this query to only match items where the value of the specified property is
450
+ * greater than or equal to `rangeStart` and less than `rangeEnd`.
451
+ *
452
+ * It only matches values of the same type. For example, a number value stored as a String type does not match the
453
+ * same number stored as a Number type.
454
+ *
455
+ * If a property contains a number as a String, that value will be compared alphabetically and not numerically. Items
456
+ * that do not have a value for the specified property are ranked lowest.
457
+ *
458
+ * The following types of properties can be compared:
459
+ * - Number: Compares numerically.
460
+ * - Date: Compares JavaScript Date objects.
461
+ * - String: Compares lexicographically, so
462
+ * - `"A"` and `"M"` are between `"A"` and `"Z"`, but `"a"`, `"m"`, `"z"` and `"Z"` are not.
463
+ * - `"A"`, `"M"`, `"Z"`, and `"a"` are between `"A"` and `"z"`, but `"z"` is not.
464
+ * @public
465
+ * @documentationMaturity preview
466
+ * @param field - The property whose value will be compared with rangeStart and rangeEnd.
467
+ * @requiredField field
468
+ * @param rangeStart - The beginning value of the range to match against.
469
+ * @requiredField rangeStart
470
+ * @param rangeEnd - The ending value of the range to match against.
471
+ * @requiredField rangeEnd
472
+ * @returns An object representing the refined query.
473
+ */
474
+ between<T extends Comparable>(field: string, rangeStart: T, rangeEnd: T): WixDataQuery;
475
+ /**
476
+ * Returns the number of items that match the query.
477
+ *
478
+ * The `count()` function returns a Promise that resolves to the number of
479
+ * items that match the query. The Promise is rejected if `count()` is called
480
+ * with incorrect permissions or if any of the functions used to refine the
481
+ * query is invalid.
482
+ *
483
+ * Calling the `count()` function triggers the `beforeCount()` and `afterCount()` hooks if they have been defined.
484
+ *
485
+ * Use the `options` parameter to run `count()` without checking for permissions
486
+ * or without its registered hooks.
487
+ *
488
+ * Any function that does not filter query results (e.g., [`ascending()`](#ascending))
489
+ * does not affect the result of `count()`.
490
+ *
491
+ * If you build a query and don't refine it with any `WixDataQuery` functions,
492
+ * `count()` returns the total number of items in the collection.
493
+ *
494
+ * If you have already run a query with `find()`, you can retrieve the number of query results without calling
495
+ * `count()`.
496
+ * @public
497
+ * @documentationMaturity preview
498
+ * @param options - An object containing options to use when processing this operation.
499
+ * @returns The number of items that match the query.
500
+ */
501
+ count(options?: WixDataReadOptions): Promise<number>;
502
+ /**
503
+ * Returns the distinct values that match the query, without duplicates.
504
+ *
505
+ * The `distinct()` function returns a Promise that resolves to:
506
+ * - The distinct values found in the specified field when running the query.
507
+ * - Additional information about the results, such as the number of values that match the query.
508
+ *
509
+ * Unlike `find()`, which returns all item objects that match the query, `distinct()` returns matching field values,
510
+ * and eliminates duplicate field values from the query result. You cannot use `find()` and `distinct()` together.
511
+ *
512
+ * For an item to be resolved as distinct, only the specified field must be distinct. Other fields for that item in
513
+ * the collection are not evaluated when resolving the promise.
514
+ *
515
+ * The Promise is rejected if `distinct()` is called with incorrect permissions or if any of the
516
+ * functions used to refine the query is invalid.
517
+ *
518
+ * >**Note:** Only site visitors with [Data Read](https://support.wix.com/en/article/collection-permissions-an-overview#permissions)
519
+ * permissions can retrieve and view data. You can override the permissions in backend code by setting the
520
+ * `suppressAuth` option to `true`.
521
+ * @public
522
+ * @documentationMaturity preview
523
+ * @param field - The property whose value will be compared for distinct values.
524
+ * @requiredField field
525
+ * @param options - An object containing options to use when processing this operation.
526
+ * @returns A Promise that resolves to the results of the query.
527
+ */
528
+ distinct(field: string, options?: WixDataQueryOptions): Promise<WixDataResult<any>>;
529
+ /**
530
+ * Returns the items that match the query.
531
+ *
532
+ * The `find()` function returns a Promise that resolves to the results found
533
+ * by the query and some information about the results. The Promise is
534
+ * rejected if `find()` is called with incorrect permissions or if any of the
535
+ * functions used to refine the query is invalid.
536
+ *
537
+ * Calling the `find()` function triggers the `beforeQuery()` and `afterQuery()` hooks if they have been defined.
538
+ *
539
+ * > **Note:**
540
+ * > Calling `find()` triggers hooks for the specified collection only. It doesn't trigger hooks for referenced
541
+ * > collections.
542
+ *
543
+ * Use the `options` parameter to override default preferences:
544
+ * - Override permission checks with `suppressAuth`.
545
+ * - Ensure the most up-to-date data is retrieved with `consistentRead`.
546
+ * - Prevent hooks from running with `suppressHooks`.
547
+ * - Speed up execution with `omitTotalCount`, if you don't need a count of items matching the query.
548
+ *
549
+ * If you build a query and don't refine it with any `wixDataQuery` functions,
550
+ * `find()` returns the entire collection.
551
+ * @public
552
+ * @documentationMaturity preview
553
+ * @param options - An object containing options to use when processing this operation.
554
+ * @returns A Promise that resolves to the results of the query.
555
+ */
556
+ find(options?: WixDataQueryOptions): Promise<WixDataResult>;
557
+ /**
558
+ * Lists the fields to return in a query's results.
559
+ *
560
+ * The `fields()` function returns only the specified fields in the query's results.
561
+ *
562
+ * You can use `include()` in conjunction with `fields()` to get referenced items.
563
+ *
564
+ * When `fields()` receives an empty or invalid property, the query behaves as follows:
565
+ * - When no fields are specified, the query returns all fields.
566
+ * - When multiple fields are specified but some are invalid, invalid fields are ignored and valid fields are returned.
567
+ * - When only invalid fields are specified, only the default `_id` field is returned.
568
+ * @public
569
+ * @documentationMaturity preview
570
+ * @param fields - Properties to return.
571
+ * @requiredField fields
572
+ * @returns A `WixDataQuery` object representing the query.
573
+ */
574
+ fields(...fields: string[]): WixDataQuery;
575
+ /**
576
+ * Limits the number of items the query returns.
577
+ *
578
+ * The `limit()` function defines the number of results a query returns in each
579
+ * page. Only one page of results is retrieved at a time. The `next()`
580
+ * and `prev()` functions are used to
581
+ * navigate the pages of a query result.
582
+ *
583
+ * By default, `limit` is set to `50`.
584
+ *
585
+ * The maximum value that `limit()` can accept is `1000`.
586
+ *
587
+ * Note that for some Wix app collections, the maximum value `limit()` can accept is
588
+ * less than `1000`. For example, the maximum limit for the Wix `Stores/Product` collection is 100.
589
+ * @public
590
+ * @documentationMaturity preview
591
+ * @param limitNumber - The number of items to return, which is also the `pageSize` of the results object.
592
+ * @requiredField limitNumber
593
+ * @returns A `WixDataQuery` object representing the refined query.
594
+ */
595
+ limit(limitNumber: number): WixDataQuery;
596
+ /**
597
+ * Sets the number of items to skip before returning query results.
598
+ *
599
+ * The `skip()` function defines the number of results to skip in the query
600
+ * results before returning new query results.
601
+ *
602
+ * For example, if you query a collection and 50 items match your query, but
603
+ * you set `skip` to 10, the results returned will skip the first 10 items
604
+ * that match and return the 11th through 50th items.
605
+ *
606
+ * By default, `skip` is set to 0.
607
+ * @public
608
+ * @documentationMaturity preview
609
+ * @param skipNumber - The number of items to skip in the query results before returning the results.
610
+ * @requiredField skipNumber
611
+ * @returns A `WixDataQuery` object representing the refined query.
612
+ */
613
+ skip(skipNumber: number): WixDataQuery;
614
+ /**
615
+ * Includes referenced items for the specified properties in a query's results.
616
+ *
617
+ * The `include()` function refines a query so that the items returned in the
618
+ * query's results include the full referenced items for the specified properties.
619
+ *
620
+ * For example, suppose you have a **books** collection with an **author**
621
+ * field that references an **authors** collection. Querying the **books**
622
+ * collection with an `include("author")` returns the relevant book items
623
+ * and each item will include the full referenced author item in the book's
624
+ * `author` property.
625
+ *
626
+ * When querying a collection that contains a reference field without using the
627
+ * `include()` function:
628
+ * - Single reference field: returned items contain only the ID of the
629
+ * referenced item, and not the full referenced items.
630
+ * - Multiple reference field: returned items do not contain the multiple
631
+ * reference field at all.
632
+ *
633
+ * When including a property with multiple references, the following limitations
634
+ * apply:
635
+ * - Only one property with multiple references can be included.
636
+ * - The query will return an error if more than 50 items are returned, regardless
637
+ * of any query limit set using the `limit()` function.
638
+ * - Each returned item can include up to 50 referenced items. If there are more
639
+ * than 50 referenced items, only 50 are returned when the query is run
640
+ * and the `partialIncludes`
641
+ * property of the returned `WixDataQueryResult`
642
+ * is `true`. To retrieve more than 50 referenced items, use the
643
+ * `queryReferenced()` function.
644
+ *
645
+ * For a discussion of when to use the similar `queryReferenced()`
646
+ * function and when to use `include()`, see [Querying Items that Reference Other Items](https://support.wix.com/en/article/including-referenced-data-when-filtering).
647
+ *
648
+ * > **Notes:**
649
+ * > - Calling the `include()` function does not trigger any hooks.
650
+ * > - The `include()` function is not supported for Single Item Collections.
651
+ * @public
652
+ * @documentationMaturity preview
653
+ * @param fieldNames - The properties for which to include referenced items.
654
+ * @requiredField fieldNames
655
+ * @returns A `WixDataQuery` object representing the query.
656
+ */
657
+ include(...fieldNames: string[]): WixDataQuery;
658
+ /**
659
+ * Overload for `include()`
660
+ * @public
661
+ * @documentationMaturity preview
662
+ */
663
+ include(fieldName: string, limit?: number): WixDataQuery;
664
+ /**
665
+ * Overload for `include()`
666
+ * @public
667
+ * @documentationMaturity preview
668
+ */
669
+ include(fieldName1: string, fieldName2: string, limit?: number): WixDataQuery;
670
+ /**
671
+ * Overload for `include()`
672
+ * @public
673
+ * @documentationMaturity preview
674
+ */
675
+ include(fieldName1: string, fieldName2: string, fieldName3: string, limit?: number): WixDataQuery;
676
+ /**
677
+ * Overload for `include()`
678
+ * @public
679
+ * @documentationMaturity preview
680
+ */
681
+ include(fieldName1: string, fieldName2: string, fieldName3: string, fieldName4: string, limit?: number): WixDataQuery;
682
+ /**
683
+ * Overload for `include()`
684
+ * @public
685
+ * @documentationMaturity preview
686
+ */
687
+ include(fieldName1: string, fieldName2: string, fieldName3: string, fieldName4: string, fieldName5: string, limit?: number): WixDataQuery;
688
+ /**
689
+ * Overload for `include()`
690
+ * @public
691
+ * @documentationMaturity preview
692
+ */
693
+ include(...fieldNamesAndLimit: [...string[], number]): WixDataQuery;
694
+ /**
695
+ * Overload for `include()`
696
+ * @public
697
+ * @documentationMaturity preview
698
+ */
699
+ include(...args: unknown[]): WixDataQuery;
700
+ }
701
+ export {};
702
+ //# sourceMappingURL=WixDataQuery.d.ts.map