@wix/wix-data-items-common 1.0.236 → 1.0.237
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/dist/cjs/api/PipelineBuilder.js +2 -2
- package/dist/cjs/api/PipelineBuilder.js.map +1 -1
- package/dist/cjs/api/WixDataAggregate.js.map +1 -1
- package/dist/cjs/api/WixDataFilter.js.map +1 -1
- package/dist/cjs/api/WixDataQuery.js.map +1 -1
- package/dist/cjs/api/WixDataSearch.js.map +1 -1
- package/dist/cjs/api/expressions/expressions.js.map +1 -1
- package/dist/cjs/api/stages/FilterStage.js.map +1 -1
- package/dist/cjs/api/stages/GroupStage.js +3 -1
- package/dist/cjs/api/stages/GroupStage.js.map +1 -1
- package/dist/cjs/api/stages/ProjectStage.js.map +1 -1
- package/dist/cjs/api/stages/SortStage.js.map +1 -1
- package/dist/cjs/api/stages/stages.js.map +1 -1
- package/dist/cjs/api/types.js.map +1 -1
- package/dist/cjs/filter/WithFilter.js.map +1 -1
- package/dist/cjs/types/data-item-types.js.map +1 -1
- package/dist/esm/api/PipelineBuilder.js +2 -2
- package/dist/esm/api/stages/FilterStage.js.map +1 -1
- package/dist/esm/api/stages/GroupStage.js +3 -1
- package/dist/esm/api/stages/GroupStage.js.map +1 -1
- package/dist/esm/api/stages/ProjectStage.js.map +1 -1
- package/dist/types/api/PipelineBuilder.d.ts +4 -4
- package/dist/types/api/WixDataAggregate.d.ts +7 -7
- package/dist/types/api/WixDataFilter.d.ts +50 -84
- package/dist/types/api/WixDataFilter.d.ts.map +1 -1
- package/dist/types/api/WixDataQuery.d.ts +44 -71
- package/dist/types/api/WixDataQuery.d.ts.map +1 -1
- package/dist/types/api/WixDataSearch.d.ts +33 -33
- package/dist/types/api/expressions/expressions.d.ts +13 -13
- package/dist/types/api/stages/FilterStage.d.ts +70 -123
- package/dist/types/api/stages/FilterStage.d.ts.map +1 -1
- package/dist/types/api/stages/GroupStage.d.ts +20 -19
- package/dist/types/api/stages/GroupStage.d.ts.map +1 -1
- package/dist/types/api/stages/ProjectStage.d.ts +6 -7
- package/dist/types/api/stages/ProjectStage.d.ts.map +1 -1
- package/dist/types/api/stages/SortStage.d.ts +2 -2
- package/dist/types/api/stages/stages.d.ts +16 -8
- package/dist/types/api/stages/stages.d.ts.map +1 -1
- package/dist/types/api/types.d.ts +2 -2
- package/dist/types/filter/WithFilter.d.ts +26 -42
- package/dist/types/filter/WithFilter.d.ts.map +1 -1
- package/dist/types/types/data-item-types.d.ts +6 -6
- package/package.json +2 -2
|
@@ -38,9 +38,9 @@ class PipelineBuilderImpl {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
|
-
* Builds an aggregation pipeline.
|
|
41
|
+
* Builds an aggregation pipeline for use with [`aggregatePipeline()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/aggregate-pipeline).
|
|
42
42
|
*
|
|
43
|
-
* Configure the pipeline by calling `pipelineBuilder()` and chaining [`PipelineBuilder`](https://dev.wix.com/docs/sdk/backend-modules/data/items/pipeline-builder/introduction) methods. Then, specify the pipeline as the `pipeline` parameter
|
|
43
|
+
* Configure the pipeline by calling `pipelineBuilder()` and chaining [`PipelineBuilder`](https://dev.wix.com/docs/sdk/backend-modules/data/items/pipeline-builder/introduction) methods. Then, specify the pipeline as the `pipeline` parameter when calling the [`aggregatePipeline()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/aggregate-pipeline) method.
|
|
44
44
|
*
|
|
45
45
|
* > **Note**: You can only build an aggregation pipeline for collections [created in the CMS](https://support.wix.com/en/article/cms-formerly-content-manager-creating-a-collection) or with the [Data Collections API](https://dev.wix.com/docs/sdk/backend-modules/data/collections/introduction). They cannot be used on [Wix app collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections) or [external collections](https://dev.wix.com/docs/develop-websites/articles/databases/external-databases/overview/integrating-external-databases-with-your-wix-site).
|
|
46
46
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PipelineBuilderImpl","constructor","_defineProperty2","default","withStages","stages","withPaging","paging","isCursor","cursorPaging","undefined","offsetPaging","build","map","stage","pipelineBuilder"],"sources":["../../../src/api/PipelineBuilder.ts"],"sourcesContent":["import { PipelineStage } from './stages/stages'\nimport { Paging, CursorPaging, AggregationPipeline } from '../types'\n\n/**\n * @builder\n */\nexport interface PipelineBuilder {\n /**\n * Adds [pipeline stages](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-aggregate-pipeline-stages/introduction) to the aggregation pipeline.\n *\n * Stages are processed sequentially in the order they are provided, with each stage's output becoming the input for the next stage.\n *\n * @public\n * @documentationMaturity preview\n * @param stages - Array of [pipeline stages](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-aggregate-pipeline-stages/introduction).\n * @returns PipelineBuilder object\n */\n withStages(stages: PipelineStage[]): PipelineBuilder\n\n /**\n * Configures pagination for the aggregation pipeline results.\n *\n * You can specify either [offset](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/api-query-language#offset-paging) or [cursor pagination](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/api-query-language#cursor-paging).\n *\n * @public\n * @documentationMaturity preview\n * @param paging - Pagination configuration.\n * @returns PipelineBuilder object\n */\n withPaging(paging: Paging | CursorPaging): PipelineBuilder\n\n /**\n * Builds the aggregation pipeline
|
|
1
|
+
{"version":3,"names":["PipelineBuilderImpl","constructor","_defineProperty2","default","withStages","stages","withPaging","paging","isCursor","cursorPaging","undefined","offsetPaging","build","map","stage","pipelineBuilder"],"sources":["../../../src/api/PipelineBuilder.ts"],"sourcesContent":["import { PipelineStage } from './stages/stages'\nimport { Paging, CursorPaging, AggregationPipeline } from '../types'\n\n/**\n * @builder\n */\nexport interface PipelineBuilder {\n /**\n * Adds [pipeline stages](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-aggregate-pipeline-stages/introduction) to the aggregation pipeline.\n *\n * Stages are processed sequentially in the order they are provided, with each stage's output becoming the input for the next stage.\n *\n * @public\n * @documentationMaturity preview\n * @param stages - Array of [pipeline stages](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-aggregate-pipeline-stages/introduction).\n * @returns PipelineBuilder object\n */\n withStages(stages: PipelineStage[]): PipelineBuilder\n\n /**\n * Configures pagination for the aggregation pipeline results.\n *\n * You can specify either [offset](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/api-query-language#offset-paging) or [cursor pagination](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/api-query-language#cursor-paging).\n *\n * @public\n * @documentationMaturity preview\n * @param paging - Pagination configuration.\n * @returns PipelineBuilder object\n */\n withPaging(paging: Paging | CursorPaging): PipelineBuilder\n\n /**\n * Builds the aggregation pipeline.\n *\n * Run this method after configuring stages and pagination to build the aggregation pipeline. Specify the pipeline as the `pipeline` parameter when calling the [`aggregatePipeline()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/aggregate-pipeline) method.\n *\n * @public\n * @documentationMaturity preview\n * @returns AggregationPipeline object ready for running the aggregation pipeline.\n */\n build(): AggregationPipeline\n}\n\nclass PipelineBuilderImpl implements PipelineBuilder {\n private stages: PipelineStage[] = []\n private offsetPaging?: Paging\n private cursorPaging?: CursorPaging\n\n withStages(stages: PipelineStage[]) {\n this.stages = stages\n return this\n }\n\n withPaging(paging: Paging | CursorPaging) {\n const isCursor = 'cursor' in paging\n this.cursorPaging = isCursor ? paging : undefined\n this.offsetPaging = isCursor ? undefined : paging\n return this\n }\n\n build() {\n return {\n stages: this.stages.map((stage) => stage.build()),\n ...(this.offsetPaging && { paging: this.offsetPaging }),\n ...(this.cursorPaging && { cursorPaging: this.cursorPaging }),\n }\n }\n}\n\n/**\n * Builds an aggregation pipeline for use with [`aggregatePipeline()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/aggregate-pipeline).\n *\n * Configure the pipeline by calling `pipelineBuilder()` and chaining [`PipelineBuilder`](https://dev.wix.com/docs/sdk/backend-modules/data/items/pipeline-builder/introduction) methods. Then, specify the pipeline as the `pipeline` parameter when calling the [`aggregatePipeline()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/aggregate-pipeline) method.\n *\n * > **Note**: You can only build an aggregation pipeline for collections [created in the CMS](https://support.wix.com/en/article/cms-formerly-content-manager-creating-a-collection) or with the [Data Collections API](https://dev.wix.com/docs/sdk/backend-modules/data/collections/introduction). They cannot be used on [Wix app collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections) or [external collections](https://dev.wix.com/docs/develop-websites/articles/databases/external-databases/overview/integrating-external-databases-with-your-wix-site).\n *\n * @public\n * @documentationMaturity preview\n * @returns PipelineBuilder object\n */\nexport function pipelineBuilder(): PipelineBuilder {\n return new PipelineBuilderImpl()\n}\n"],"mappings":";;;;;;AAGA;AACA;AACA;;AAsCA,MAAMA,mBAAmB,CAA4B;EAAAC,YAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA,kBACjB,EAAE;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;EAAA;EAIpCC,UAAUA,CAACC,MAAuB,EAAE;IAClC,IAAI,CAACA,MAAM,GAAGA,MAAM;IACpB,OAAO,IAAI;EACb;EAEAC,UAAUA,CAACC,MAA6B,EAAE;IACxC,MAAMC,QAAQ,GAAG,QAAQ,IAAID,MAAM;IACnC,IAAI,CAACE,YAAY,GAAGD,QAAQ,GAAGD,MAAM,GAAGG,SAAS;IACjD,IAAI,CAACC,YAAY,GAAGH,QAAQ,GAAGE,SAAS,GAAGH,MAAM;IACjD,OAAO,IAAI;EACb;EAEAK,KAAKA,CAAA,EAAG;IACN,OAAO;MACLP,MAAM,EAAE,IAAI,CAACA,MAAM,CAACQ,GAAG,CAAEC,KAAK,IAAKA,KAAK,CAACF,KAAK,CAAC,CAAC,CAAC;MACjD,IAAI,IAAI,CAACD,YAAY,IAAI;QAAEJ,MAAM,EAAE,IAAI,CAACI;MAAa,CAAC,CAAC;MACvD,IAAI,IAAI,CAACF,YAAY,IAAI;QAAEA,YAAY,EAAE,IAAI,CAACA;MAAa,CAAC;IAC9D,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASM,eAAeA,CAAA,EAAoB;EACjD,OAAO,IAAIf,mBAAmB,CAAC,CAAC;AAClC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../../src/api/WixDataAggregate.ts"],"sourcesContent":["import { WixDataFilter } from './WixDataFilter'\nimport { WixDataAggregateOptions } from './types'\nimport { WixDataResult } from './WixDataResult'\n\n/**\n * @builder\n */\nexport interface WixDataAggregate {\n /**\n * Refines a `WixDataAggregate` to contain the sum from each aggregation group.\n *\n * The `sum()` method refines a `WixDataAggregate` to contain the sum of the\n * values from the specified field for each aggregated group or from the\n * whole collection if no group is defined.\n *\n * When the aggregation is `run()`, the returned `WixDataAggregateResult`\n * object contains an item for each group with the following key:value pairs:\n * - If a value was passed for the optional `projectedField`, the key is named\n * using that value. Otherwise, the key is named using the following format:\n * `\"fieldSum\"`, where `field` is the name of the specified field.\n * - The value is the sum of the values found in the specified field.\n *\n * Sums can only be calculated on fields of type Number.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to find the sum.\n * @requiredField field\n * @param projectedField - Name of the field in the aggregation results containing the sum.\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n sum(field: string, projectedField?: string): WixDataAggregate\n\n /**\n * Refines a `WixDataAggregate` to only contain the average value from each aggregation group.\n *\n * The `avg()` method refines a `WixDataAggregate` to contain the average\n * value from the specified field for each aggregated group or from the\n * whole collection if no group is defined.\n *\n * When the aggregation is `run()`, the returned `WixDataAggregateResult`\n * object contains an item for each group with the following key:value pairs:\n * - If a value was passed for the optional `projectedField`, the key is named\n * using that value. Otherwise, the key is named using the following format:\n * `\"fieldAvg\"`, where `field` is the name of the specified field.\n * - The value is the average of the values found in the specified field.\n *\n * Averages can only be calculated on fields of type Number.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to find the average value.\n * @requiredField field\n * @param projectedField - Field in the aggregation results containing the average value.\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n avg(field: string, projectedField?: string): WixDataAggregate\n\n /**\n * Refines a `WixDataAggregate` to only contain the minimum value from each aggregation group.\n *\n * The `min()` method refines a `WixDataAggregate` to contain the minimum\n * value from the specified field for each aggregated group or from the\n * whole collection if no group is defined.\n *\n * When the aggregation is `run()`, the returned `WixDataAggregateResult`\n * object contains an item for each group with the following key:value pairs:\n * - If a value was passed for the optional `projectedField`, the key is named\n * using that value. Otherwise, the key is named using the following format:\n * `\"fieldMin\"`, where `field` is the name of the specified field.\n * - The value is the minimum value found in the specified field.\n *\n * The following types of fields can be compared to determine a minimum value:\n * - Number: Compares numerically.\n * - Date and Time: Compares JavaScript Date objects.\n * - Text: Compares lexicographically, so `\"text\"` is greater than `\"Text\"`.\n * - Rich Text: Compares HTML source as text.\n * - URL: Compares as text.\n * - Image: Compares image source as text.\n * - Video: Compares video source as text.\n * - Document: Compares document source as text.\n * - Reference: Compares by the ID of the referenced item as a String.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to find the minimum value.\n * @requiredField field\n * @param projectedField - Name of the field in the aggregation results containing the minimum value.\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n min(field: string, projectedField?: string): WixDataAggregate\n\n /**\n * Refines a `WixDataAggregate` to only contain the maximum value from each aggregation group.\n *\n * The `max()` method refines a `WixDataAggregate` to contain the maximum\n * value from the specified field for each aggregated group or from the\n * whole collection if no group is defined.\n *\n * When the aggregation is `run()`, the returned `WixDataAggregateResult`\n * object contains an item for each group with the following key:value pairs:\n * - If a value was passed for the optional `projectedField`, the key is named\n * using that value. Otherwise, the key is named using the following format:\n * `\"fieldMax\"`, where `field` is the name of the specified field.\n * - The value is the maximum value found in the specified field.\n *\n * The following types of fields can be compared to determine a maximum value:\n * - Number: Compares numerically.\n * - Date and Time: Compares JavaScript Date objects.\n * - Text: Compares lexicographically, so `\"text\"` is greater than `\"Text\"`.\n * - Rich Text: Compares HTML source as text.\n * - URL: Compares as text.\n * - Image: Compares image source as text.\n * - Video: Compares video source as text.\n * - Document: Compares document source as text.\n * - Reference: Compares by the ID of the referenced item as a String.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to find the maximum value.\n * @requiredField field\n * @param projectedField - Field in the aggregation results that contains the maximum value.\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n max(field: string, projectedField?: string): WixDataAggregate\n\n /**\n * Refines a `WixDataAggregate` to contain the item count of each group in the aggregation.\n *\n * The `count()` method refines a `WixDataAggregate` contains the item count in each of the aggregate's groups.\n *\n * When the aggregation is `run()`, the returned `WixDataAggregateResult`\n * object contains items with the following additional key:value pair:\n * - The key is named `count`. You can set a custom key using the `projectedField` parameter.\n * - The value is the count of items aggregated in the group.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param projectedField - Field in the aggregation results that contains the count value. Default: `count`.\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n count(projectedField?: string): WixDataAggregate\n\n /**\n * Filters out items from being used in an aggregation.\n *\n * The `filter()` method refines a `WixDataAggregate` so that it only\n * includes items from the aggregate's collection which match the specified\n * filter criteria.\n *\n * To create a filter, use the wix-data `filter()` method.\n *\n * Filtering using `filter()` takes place before grouping is performed on the\n * aggregation. To filter grouped results, use the `having()` method.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to use to filter out items from being used in the aggregation.\n * @requiredField filter\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n filter(filter: WixDataFilter): WixDataAggregate\n\n /**\n * Groups items together in an aggregation.\n *\n * The `group()` method refines a `WixDataAggregate` so that its items are\n * grouped by the specified field or fields.\n *\n * You can perform aggregations on the groups using the following methods:\n * - `avg()`\n * - `count()`\n * - `max()`\n * - `min()`\n * - `sum()`\n *\n * To filter grouped results, use the `having()` method.\n *\n * > **Notes:**\n * > - Aggregations can only be used on collections you have created. They cannot be used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * > - You can only call the `group()` method once per aggregate query.\n * @public\n * @documentationMaturity preview\n * @param field - Field or fields to group on.\n * @requiredField field\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n group(...field: string[]): WixDataAggregate\n\n /**\n * Filters out groups from being returned from an aggregation.\n *\n * The `having()` method refines a `WixDataAggregate` so that it only\n * includes groups from the aggregate's grouping which match the specified\n * filter criteria.\n *\n * To create a filter, use the wix-data `filter()` method.\n *\n * Filtering using `having()` takes place after grouping is performed on the\n * aggregation. To filter items before grouping, use the `filter()` method.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be used in [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to use to filter out groups from being returned from the aggregation.\n * @requiredField filter\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n having(filter: WixDataFilter): WixDataAggregate\n\n /**\n * Limits the number of items or groups the aggregation returns.\n *\n * The `limit()` method defines the number of results an aggregation returns in each\n * page. Only one page of results is retrieved at a time. The `next()`\n * method is used to navigate the pages of a query result.\n *\n * By default, `limit` is set to `50`.\n *\n * The maximum value that `limit()` can accept is `1000`.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param limit - Number of items or groups to return.\n * @requiredField limit\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n limit(limit: number): WixDataAggregate\n\n /**\n * Sets the number of items or groups to skip before returning aggregation results.\n *\n * The `skip()` method defines the number of results to skip in the aggregation\n * results before returning new aggregation results.\n *\n * For example, if you perform an aggregation on a collection and 10 groups match\n * your aggregation, but you set `skip` to 3, the results returned will skip\n * the first 3 groups that match and return the 4th through 10th items.\n *\n * By default, `skip` is set to 0.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).\n * @public\n * @documentationMaturity preview\n * @param skip - Number of items or groups to skip in the aggregation results before returning the results.\n * @requiredField skip\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n skip(skip: number): WixDataAggregate\n\n /**\n * Adds a sort to a query or sort, sorting by the specified fields in descending order.\n *\n * The `descending()` method refines this query to sort in descending order of the specified fields. If you\n * specify more than one field, descending() sorts the results in descending order by each field in the order\n * they are listed.\n *\n * You can sort the following types:\n *\n * Number: Sorts numerically.\n * - Date: Sorts by date and time.\n * - String: Sorts lexicographically, so `\"abc\"` comes before `\"XYZ\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n *\n * If a field contains a number as a String, that value is sorted alphabetically and not numerically. Items\n * that do not have a value for the specified sort field are ranked lowest.\n *\n * > **Note**: Aggregations can only be used on collections you have created. They cannot be used on [Wix app collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).\n * @public\n * @documentationMaturity preview\n * @param fields - Fields used in the sort.\n * @requiredField fields\n * @returns Refined query.\n */\n descending(...fields: string[]): WixDataAggregate\n\n descending(fields: string[]): WixDataAggregate\n\n descending(...fields: any): WixDataAggregate\n\n /**\n * Adds a sort to a query or sort, sorting by the specified fields in ascending order.\n *\n * The `ascending()` method refines this query in ascending order of the specified fields. If you specify more\n * than one field, `ascending()` sorts the results in ascending order by each field in the order they are listed.\n *\n * You can sort the following types:\n * - Number: Sorts numerically.\n * - Date: Sorts by date and time.\n * - String: Sorts lexicographically, so `\"abc\"` comes after `\"XYZ\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n *\n * If a field contains a number as a String, that value is sorted alphabetically and not numerically.\n * Items that do not have a value for the specified sort field are ranked lowest.\n *\n * > **Note**: Aggregations can only be used on collections you have created. They cannot be used on [Wix app collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).\n * @public\n * @documentationMaturity preview\n * @param fields - Fields used in the sort.\n * @requiredField fields\n * @returns Refined query.\n */\n ascending(...fields: string[]): WixDataAggregate\n\n ascending(fields: string[]): WixDataAggregate\n\n ascending(...fields: any): WixDataAggregate\n\n /**\n * Runs the aggregation and returns the results.\n *\n * The `run()` method returns a Promise that resolves to the results found\n * by the aggregation and some information about the results.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param options - Options to use when running an aggregation.\n * @returns Promise that resolves to the results of the aggregation.\n */\n run(\n options?: WixDataAggregateOptions\n ): Promise<WixDataResult<Record<string, any>>>\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/api/WixDataAggregate.ts"],"sourcesContent":["import { WixDataFilter } from './WixDataFilter'\nimport { WixDataAggregateOptions } from './types'\nimport { WixDataResult } from './WixDataResult'\n\n/**\n * @builder\n */\nexport interface WixDataAggregate {\n /**\n * Refines a `WixDataAggregate` to contain the sum from each aggregation group.\n *\n * The `sum()` method refines a `WixDataAggregate` to contain the sum of the\n * values from the specified field for each aggregated group or from the\n * whole collection if no group is defined.\n *\n * When the aggregation is `run()`, the returned `WixDataAggregateResult`\n * object contains an item for each group with the following key-value pairs:\n * - If a value was passed for the optional `projectedField`, the key is named\n * using that value. Otherwise, the key is named using the following format:\n * `\"fieldSum\"`, where `field` is the name of the specified field.\n * - The value is the sum of the values found in the specified field.\n *\n * Sums can only be calculated on fields of type Number.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to find the sum.\n * @requiredField field\n * @param projectedField - Name of the field in the aggregation results containing the sum.\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n sum(field: string, projectedField?: string): WixDataAggregate\n\n /**\n * Refines a `WixDataAggregate` to only contain the average value from each aggregation group.\n *\n * The `avg()` method refines a `WixDataAggregate` to contain the average\n * value from the specified field for each aggregated group or from the\n * whole collection if no group is defined.\n *\n * When the aggregation is `run()`, the returned `WixDataAggregateResult`\n * object contains an item for each group with the following key-value pairs:\n * - If a value was passed for the optional `projectedField`, the key is named\n * using that value. Otherwise, the key is named using the following format:\n * `\"fieldAvg\"`, where `field` is the name of the specified field.\n * - The value is the average of the values found in the specified field.\n *\n * Averages can only be calculated on fields of type Number.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to find the average value.\n * @requiredField field\n * @param projectedField - Field in the aggregation results containing the average value.\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n avg(field: string, projectedField?: string): WixDataAggregate\n\n /**\n * Refines a `WixDataAggregate` to only contain the minimum value from each aggregation group.\n *\n * The `min()` method refines a `WixDataAggregate` to contain the minimum\n * value from the specified field for each aggregated group or from the\n * whole collection if no group is defined.\n *\n * When the aggregation is `run()`, the returned `WixDataAggregateResult`\n * object contains an item for each group with the following key-value pairs:\n * - If a value was passed for the optional `projectedField`, the key is named\n * using that value. Otherwise, the key is named using the following format:\n * `\"fieldMin\"`, where `field` is the name of the specified field.\n * - The value is the minimum value found in the specified field.\n *\n * The following types of fields can be compared to determine a minimum value:\n * - Number: Compares numerically.\n * - Date and Time: Compares JavaScript Date objects.\n * - Text: Compares lexicographically, so `\"text\"` is greater than `\"Text\"`.\n * - Rich Text: Compares HTML source as text.\n * - URL: Compares as text.\n * - Image: Compares image source as text.\n * - Video: Compares video source as text.\n * - Document: Compares document source as text.\n * - Reference: Compares by the ID of the referenced item as a String.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to find the minimum value.\n * @requiredField field\n * @param projectedField - Name of the field in the aggregation results containing the minimum value.\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n min(field: string, projectedField?: string): WixDataAggregate\n\n /**\n * Refines a `WixDataAggregate` to only contain the maximum value from each aggregation group.\n *\n * The `max()` method refines a `WixDataAggregate` to contain the maximum\n * value from the specified field for each aggregated group or from the\n * whole collection if no group is defined.\n *\n * When the aggregation is `run()`, the returned `WixDataAggregateResult`\n * object contains an item for each group with the following key-value pairs:\n * - If a value was passed for the optional `projectedField`, the key is named\n * using that value. Otherwise, the key is named using the following format:\n * `\"fieldMax\"`, where `field` is the name of the specified field.\n * - The value is the maximum value found in the specified field.\n *\n * The following types of fields can be compared to determine a maximum value:\n * - Number: Compares numerically.\n * - Date and Time: Compares JavaScript Date objects.\n * - Text: Compares lexicographically, so `\"text\"` is greater than `\"Text\"`.\n * - Rich Text: Compares HTML source as text.\n * - URL: Compares as text.\n * - Image: Compares image source as text.\n * - Video: Compares video source as text.\n * - Document: Compares document source as text.\n * - Reference: Compares by the ID of the referenced item as a String.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to find the maximum value.\n * @requiredField field\n * @param projectedField - Field in the aggregation results that contains the maximum value.\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n max(field: string, projectedField?: string): WixDataAggregate\n\n /**\n * Refines a `WixDataAggregate` to contain the item count of each group in the aggregation.\n *\n * The `count()` method refines a `WixDataAggregate` contains the item count in each of the aggregate's groups.\n *\n * When the aggregation is `run()`, the returned `WixDataAggregateResult`\n * object contains items with the following additional key-value pair:\n * - The key is named `count`. You can set a custom key using the `projectedField` parameter.\n * - The value is the count of items aggregated in the group.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param projectedField - Field in the aggregation results that contains the count value. Default: `count`.\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n count(projectedField?: string): WixDataAggregate\n\n /**\n * Filters out items from being used in an aggregation.\n *\n * The `filter()` method refines a `WixDataAggregate` so that it only\n * includes items from the aggregate's collection which match the specified\n * filter criteria.\n *\n * To create a filter, use the wix-data `filter()` method.\n *\n * Filtering using `filter()` takes place before grouping is performed on the\n * aggregation. To filter grouped results, use the `having()` method.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to use to filter out items from being used in the aggregation.\n * @requiredField filter\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n filter(filter: WixDataFilter): WixDataAggregate\n\n /**\n * Groups items together in an aggregation.\n *\n * The `group()` method refines a `WixDataAggregate` so that its items are\n * grouped by the specified field or fields.\n *\n * You can perform aggregations on the groups using the following methods:\n * - `avg()`\n * - `count()`\n * - `max()`\n * - `min()`\n * - `sum()`\n *\n * To filter grouped results, use the `having()` method.\n *\n * > **Notes:**\n * > - Aggregations can only be used on collections you have created. They cannot be used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * > - You can only call the `group()` method once per aggregate query.\n * @public\n * @documentationMaturity preview\n * @param field - Field or fields to group on.\n * @requiredField field\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n group(...field: string[]): WixDataAggregate\n\n /**\n * Filters out groups from being returned from an aggregation.\n *\n * The `having()` method refines a `WixDataAggregate` so that it only\n * includes groups from the aggregate's grouping which match the specified\n * filter criteria.\n *\n * To create a filter, use the wix-data `filter()` method.\n *\n * Filtering using `having()` takes place after grouping is performed on the\n * aggregation. To filter items before grouping, use the `filter()` method.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be used in [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to use to filter out groups from being returned from the aggregation.\n * @requiredField filter\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n having(filter: WixDataFilter): WixDataAggregate\n\n /**\n * Limits the number of items or groups the aggregation returns.\n *\n * The `limit()` method defines the number of results an aggregation returns in each\n * page. Only one page of results is retrieved at a time. The `next()`\n * method is used to navigate the pages of a query result.\n *\n * By default, `limit` is set to `50`.\n *\n * The maximum value that `limit()` can accept is `1000`.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param limit - Number of items or groups to return.\n * @requiredField limit\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n limit(limit: number): WixDataAggregate\n\n /**\n * Sets the number of items or groups to skip before returning aggregation results.\n *\n * The `skip()` method defines the number of results to skip in the aggregation\n * results before returning new aggregation results.\n *\n * For example, if you perform an aggregation on a collection and 10 groups match\n * your aggregation, but you set `skip` to 3, the results returned will skip\n * the first 3 groups that match and return the 4th through 10th items.\n *\n * By default, `skip` is set to 0.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).\n * @public\n * @documentationMaturity preview\n * @param skip - Number of items or groups to skip in the aggregation results before returning the results.\n * @requiredField skip\n * @returns `WixDataAggregate` object representing the refined aggregation.\n */\n skip(skip: number): WixDataAggregate\n\n /**\n * Adds a sort to a query or sort, sorting by the specified fields in descending order.\n *\n * The `descending()` method refines this query to sort in descending order of the specified fields. If you\n * specify more than one field, descending() sorts the results in descending order by each field in the order\n * they are listed.\n *\n * You can sort the following types:\n *\n * Number: Sorts numerically.\n * - Date: Sorts by date and time.\n * - String: Sorts lexicographically, so `\"abc\"` comes before `\"XYZ\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n *\n * If a field contains a number as a String, that value is sorted alphabetically and not numerically. Items\n * that do not have a value for the specified sort field are ranked lowest.\n *\n * > **Note**: Aggregations can only be used on collections you have created. They cannot be used on [Wix app collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).\n * @public\n * @documentationMaturity preview\n * @param fields - Fields to sort by.\n * @requiredField fields\n * @returns Refined query.\n */\n descending(...fields: string[]): WixDataAggregate\n\n descending(fields: string[]): WixDataAggregate\n\n descending(...fields: any): WixDataAggregate\n\n /**\n * Adds a sort to a query or sort, sorting by the specified fields in ascending order.\n *\n * The `ascending()` method refines this query in ascending order of the specified fields. If you specify more\n * than one field, `ascending()` sorts the results in ascending order by each field in the order they are listed.\n *\n * You can sort the following types:\n * - Number: Sorts numerically.\n * - Date: Sorts by date and time.\n * - String: Sorts lexicographically, so `\"abc\"` comes after `\"XYZ\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n *\n * If a field contains a number as a String, that value is sorted alphabetically and not numerically.\n * Items that do not have a value for the specified sort field are ranked lowest.\n *\n * > **Note**: Aggregations can only be used on collections you have created. They cannot be used on [Wix app collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).\n * @public\n * @documentationMaturity preview\n * @param fields - Fields to sort by.\n * @requiredField fields\n * @returns Refined query.\n */\n ascending(...fields: string[]): WixDataAggregate\n\n ascending(fields: string[]): WixDataAggregate\n\n ascending(...fields: any): WixDataAggregate\n\n /**\n * Runs the aggregation and returns the results.\n *\n * The `run()` method returns a Promise that resolves to the results found\n * by the aggregation and some information about the results.\n *\n * > **Note:** Aggregations can only be used on collections you have created. They cannot be\n * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).\n * @public\n * @documentationMaturity preview\n * @param options - Options to use when running an aggregation.\n * @returns Promise that resolves to the results of the aggregation.\n */\n run(\n options?: WixDataAggregateOptions\n ): Promise<WixDataResult<Record<string, any>>>\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../../src/api/WixDataFilter.ts"],"sourcesContent":["/**\n * @builder\n */\nexport interface WixDataFilter {\n /**\n * Refines a filter to match items whose specified field value equals the specified value.\n *\n * The `eq()` method refines this filter to only\n * match items where the value of the specified field equals the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * Matching strings with `eq()` is case sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If `field` points to a collection field of type array, `eq()` includes the item as long as at least one array element matches the specified `value`.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to compare with.\n * @requiredField value\n * @returns Refined filter.\n */\n eq(field: string, value: any): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value does not equal the specified value.\n *\n * The `ne()` method refines this filter to only\n * match items where the value of the specified field does not equal the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type is considered not equal to the same number stored as a Number type.\n *\n * Matching strings with `ne()` is case sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If the value of `field` is an array, `ne()` includes items\n * in which none of the elements of the array match the specified `value`.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns Refined filter.\n */\n ne(field: string, value: any): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value is greater than or equal to the specified\n * value.\n *\n * The `ge()` method refines this filter to only\n * match items where the value of the specified field is greater than or\n * equal to the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified field are ranked lowest.\n *\n * The following field types can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically,\n * so `\"abc\"` is greater than or equal to `\"ABC\"` (because of the greater than),\n * but `\"ABC\"` is not greater than or equal to `\"abc\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns Refined filter.\n */\n ge(field: string, value: string | number | Date): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value is greater than the specified value.\n *\n * The `gt()` method refines this filter to only match\n * items where the value of the specified field is greater than the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified field are ranked lowest.\n *\n * The following field types can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"text\"` is greater than `\"Text\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns An object with the filter definition, based on the supplied parameters.\n */\n gt(field: string, value: string | number | Date): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value is less than or equal to the specified\n * value.\n *\n * The `le()` method refines this filter to only match\n * items where the value of the specified field is less than or equal to the\n * specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified field are ranked lowest.\n *\n * The following field types can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically,\n * so `\"ABC\"` is less than or equal to `\"abc\"` (because of the less than),\n * but `\"abc\"` is not less than or equal to `\"ABC\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns Refined filter.\n */\n le(field: string, value: string | number | Date): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value is less than the specified value.\n *\n * The `lt()` method refines this filter to only match\n * items where the value of the specified field is less than the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified field are ranked lowest.\n *\n * The following field types can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"Text\"` is less than `\"text\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns An object with the filter definition, based on the supplied parameters.\n */\n lt(field: string, value: string | number | Date): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field has any value.\n *\n * The `isNotEmpty()` method refines this filter to only match items where the\n * value of the specified field is not `null` or `undefined`.\n *\n * If the field contains any value at all for a given item, including the\n * empty string or an invalid value, that item will match the filter.\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to check for a value.\n * @requiredField field\n * @returns Refined filter.\n */\n isNotEmpty(field: string): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field does not exist or does not have any value.\n *\n * The `isEmpty()` method refines this filter to only match items where the\n * value of the specified field is `null` or `undefined` or the field does\n * not exist.\n *\n * If the field contains any value at all for a given item, including the\n * empty string or an invalid value, that item will match the filter.\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to check for a value.\n * @requiredField field\n * @returns An object representing the refined filter.\n */\n isEmpty(field: string): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value starts with a specified string.\n *\n * The `startsWith()` method refines this filter to\n * only match items where the value of the specified field starts with the\n * defined `string`. Matching with `startsWith()` is not case sensitive, so `\"TEXT\"` starts\n * with `\"tex\"`.\n *\n * You can only use `startsWith()` with a field whose value is a String or Reference.\n * When using a Reference, `startsWith()` matches by the ID of the referenced item as Strings.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the `value` parameter.\n * @requiredField field\n * @param value - Value to look for at the beginning of the specified field value.\n * @requiredField value\n * @returns Refined filter.\n */\n startsWith(field: string, value: string): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value ends with a specified string.\n *\n * The `endsWith()` method refines this filter to only\n * match items where the value of the specified field ends with the specified\n * `string`. Matching with `endsWith()` is not case sensitive, so `\"TEXT\"` ends\n * with `\"ext\"`.\n *\n * You can only use `endsWith()` with a field whose value is a String or Reference.\n * When using a Reference, `endsWith()` matches by the ID of the referenced item as Strings.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the string.\n * @requiredField field\n * @param value - Value to look for at the end of the specified field value.\n * @requiredField value\n * @returns Refined filter.\n */\n endsWith(field: string, value: string): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value contains the specified value.\n *\n * The `contains()` method refines the filter to only match items for which the value of the specified field contains the specified value. `contains()` is not case-sensitive, so the value `sunday` is considered to contain the value `Sun`.\n *\n * You can use `contains()` with a field whose type is a string or a reference. However, for fields whose type is reference, `contains()` matches by the ID of the referenced item as a string. Instead, use the [`eq()`](https://dev.wix.com/docs/sdk/backend-modules/data/wix-data-items-sdk-1-0-0/wix-data-filter/eq) method.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the provided value.\n * @requiredField field\n * @param value - Value to locate in the specified field value.\n * @requiredField value\n * @returns Refined filter.\n */\n contains(field: string, value: string): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value equals any of the specified `values`\n * parameters.\n *\n * The `hasSome()` method refines this filter to\n * only match items where the value of the specified field equals any of\n * the specified values.\n *\n * Matching strings with `hasSome()` is case sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If the value of the specified field is an array, `hasSome()` will match\n * if any of the elements of that array match any of the specified values.\n *\n * If the specified field contains multiple references, pass item IDs in the\n * `value` field. In such a case, `hasSome()` will match if any of the\n * multiple references match any of the specified ID values.\n *\n * You can specify a list of values to match by providing an array of\n * String, Number, or Date types as the `value` parameters.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param values - Values to match.\n * @requiredField values\n * @returns An object representing the refined filter.\n */\n hasSome(field: string, ...values: string[] | number[] | Date[]): WixDataFilter\n\n /**\n * Overload for `hasSome()`\n * @public\n * @documentationMaturity preview\n */\n hasSome(field: string, values: string[] | number[] | Date[]): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field values equals all of the specified `value`\n * parameters.\n *\n * The `hasAll()` method refines this filter to\n * only match items where the value of the specified field equals all of\n * the specified values.\n *\n * Matching strings with `hasAll()` is case sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If the value of the specified field is an array, `hasAll()` will match\n * if there is a match in the elements of that array for all of the specified\n * values.\n *\n * You can specify a list of values to match by providing an array of\n * String, Number, or Date types as the `value` parameters.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `values`.\n * @requiredField field\n * @param values - Values to match.\n * @requiredField values\n * @returns An object representing the refined filter.\n */\n hasAll(field: string, ...values: string[] | number[] | Date[]): WixDataFilter\n\n /**\n * Overload for `hasAll()`\n * @public\n * @documentationMaturity preview\n */\n hasAll(field: string, values: string[] | number[] | Date[]): WixDataFilter\n\n /**\n * Adds an `or` condition to the filter.\n *\n * The `or()` method adds an inclusive `or` condition to this filter. A filter\n * with an `or` returns all the items that match the filter as defined up to\n * the `or` method, the items that match the filter passed to the `or`\n * method, and the items that match both.\n *\n * The `or()` method is designed to work with 2 or more queries or filters.\n * If you use it on its own, it will return all the items in a collection.\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial filter as an `or` condition.\n * @requiredField filter\n * @returns Object representing the refined filter.\n */\n or(filter: WixDataFilter): WixDataFilter\n\n /**\n * Adds an `and` condition to the filter.\n *\n * A filter with an `and` condition returns all items that meet the conditions defined on both sides of the condition.\n *\n * Use the `and()` method when performing compound queries. For example, the final filter in this set of\n * queries returns results where status is either pending or rejected **and** age is either less than 25 or greater\n * than 65.\n *\n * ```js\n * let statusFilter = items.filter()\n * .eq(\"status\", \"pending\")\n * .or(items.filter().eq(\"status\", \"rejected\"));\n *\n * let ageFilter = items.filter()\n * .lt(\"age\", 25)\n * .or(items.filter().gt(\"age\", 65));\n *\n * let statusAndAgeFilter = statusFilter.and(ageFilter);\n * ```\n *\n * > **Notes**:\n * > - The `and()` method is designed to work with 2 or more queries or filters. If used with a single query or filter, it returns all items in a collection.\n * > - When chaining multiple `WixDataFilter` methods to a filter, an `and` condition is implied. In such cases, you do not need to call the `and()` method explicitly. For example, this filter returns results where an item `status` is `active` and `age` is greater than 25:\n *\n * ```js\n * items.filter().eq(\"status\", \"active\").gt(\"age\", 25);\n * ```\n *\n * @public\n * @documentationMaturity preview\n * @param filter - `WixDataFilter` used with an `and` condition.\n * @requiredField filter\n * @returns The compound filter.\n */\n and(filter: WixDataFilter): WixDataFilter\n\n /**\n * Adds a `not` condition to the filter.\n *\n * The `not()` method adds a `not` condition to this filter. A filter with a `not`\n * returns all the items that match the filter as defined up to the `not`\n * method, but don't match the filter passed to the `not` method.\n *\n * If the filter only contains a `not()` method, it returns all the items\n * that don't match the filter defined by the `not` method.\n *\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial filter as a `not` condition.\n * @requiredField filter\n * @returns Object representing the refined filter.\n */\n not(filter: WixDataFilter): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field value is within the defined range.\n *\n * The `between()` method refines this filter to match items for which the value of the specified field is greater than or equal to `rangeStart` and less than `rangeEnd`. The method only compares values of [the same type](https://support.wix.com/en/article/cms-formerly-content-manager-about-your-collection-fields#field-type).\n *\n * The following types can be compared:\n * - Number: Compared numerically.\n * - Date: Compared as JavaScript Date objects.\n * - String: Compared lexicographically:\n * - `\"A\"` and `\"M\"` are considered between `\"A\"` and `\"Z\"`, but `\"a\"`, `\"m\"`, `\"z\"` and `\"Z\"` are not.\n * - `\"A\"`, `\"M\"`, `\"Z\"`, and `\"a\"` are considered between `\"A\"` and `\"z\"`, but `\"z\"` is not.\n *\n * > **Note**: Items that do not have a value for the specified field are considered as the lowest comparable value and are ranked last.\n *\n * @public\n * @documentationMaturity preview\n * @param field - Field to compare with `rangeStart` and `rangeEnd`.\n * @requiredField field\n * @param rangeStart - Starting value of the range to match.\n * @requiredField rangeStart\n * @param rangeEnd - Ending value of the range to match.\n * @requiredField rangeEnd\n * @returns Refined filter.\n */\n between(\n field: string,\n rangeStart: string | number | Date,\n rangeEnd: string | number | Date\n ): WixDataFilter\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/api/WixDataFilter.ts"],"sourcesContent":["/**\n * @builder\n */\nexport interface WixDataFilter {\n /**\n * Refines a filter to match items where the value of the specified field equals the specified value.\n *\n * The `eq()` method refines this filter to only\n * match items where the value of the specified field equals the specified `value`.\n *\n * Values of different [types](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data) are always considered not equal. For example, a number value stored as a string does not match the same number stored as a number.\n *\n * Matching strings with `eq()` is case sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If `field` points to a collection field of type array, `eq()` includes the item as long as at least one array element matches the specified `value`.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to compare with.\n * @requiredField value\n * @returns Refined filter.\n */\n eq(field: string, value: any): WixDataFilter\n\n /**\n * Refines a filter to match items where the value of the specified field does not equal the specified value.\n *\n * The `ne()` method refines this filter to only match items where the value of the specified field does not equal the specified value.\n *\n * The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data). For example, a number value stored as a string is considered not equal to the same number stored as a number.\n *\n * Matching strings with `ne()` is case sensitive, so `\"text\"` is considered not equal to `\"Text\"`.\n *\n * If the value of `field` is an array, `ne()` matches items where none of the elements of the array match the specified value.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns Refined filter.\n */\n ne(field: string, value: any): WixDataFilter\n\n /**\n * Refines a filter to match items where the value of the specified field is greater than or equal to the specified\n * value.\n *\n * The `ge()` method refines this filter to only match items where the value of the specified field is greater than or equal to the specified value.\n *\n * The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data). For example, a number value stored as a string does not match the same number stored as a number.\n *\n * If a field contains a number as a string, that value is compared alphabetically and not numerically. Items that do not have a value for the specified field are ranked lowest.\n *\n * The following field types can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically,\n * so `\"abc\"` is greater than or equal to `\"ABC\"` (because of the greater than),\n * but `\"ABC\"` is not greater than or equal to `\"abc\"`.\n * - Reference: Compares by the ID of the referenced item as a string.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the specified value.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns Refined filter.\n */\n ge(field: string, value: string | number | Date): WixDataFilter\n\n /**\n * Refines a filter to match items where the value of the specified field is greater than the specified value.\n *\n * The `gt()` method refines this filter to only match items where the value of the specified field is greater than the specified value.\n *\n * The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data). For example, a number value stored as a string does not match the same number stored as a number.\n *\n * If a field contains a number as a string, that value is compared alphabetically and not numerically. Items that do not have a value for the specified field are ranked lowest.\n *\n * The following field types can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"text\"` is greater than `\"Text\"`.\n * - Reference: Compares by the ID of the referenced item as a string.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the specified value.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns Refined filter.\n */\n gt(field: string, value: string | number | Date): WixDataFilter\n\n /**\n * Refines a filter to match items where the value of the specified field is less than or equal to the specified value.\n *\n * The `le()` method refines this filter to only match items where the value of the specified field is less than or equal to the specified value.\n *\n * The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data). For example, a number value stored as a string does not match the same number stored as a number.\n *\n * If a field contains a number as a string, that value is compared alphabetically and not numerically. Items that do not have a value for the specified field are ranked lowest.\n *\n * The following field types can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically,\n * so `\"ABC\"` is less than or equal to `\"abc\"` (because of the less than),\n * but `\"abc\"` is not less than or equal to `\"ABC\"`.\n * - Reference: Compares by the ID of the referenced item as a string.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the specified value.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns Refined filter.\n */\n le(field: string, value: string | number | Date): WixDataFilter\n\n /**\n * Refines a filter to match items where the value of the specified field is less than the specified value.\n *\n * The `lt()` method refines this filter to only match\n * items where the value of the specified field is less than the specified `value`.\n *\n * The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data). For example, a number value stored\n * as a string does not match the same number stored as a number.\n *\n * If a field contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified field are ranked lowest.\n *\n * The following field types can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"Text\"` is less than `\"text\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns An object with the filter definition, based on the supplied parameters.\n */\n lt(field: string, value: string | number | Date): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field has any value.\n *\n * The `isNotEmpty()` method refines this filter to only match items where the\n * value of the specified field is not `null` or `undefined`.\n *\n * If the field contains any value at all for a given item, including the\n * empty string or an invalid value, that item will match the filter.\n * @public\n * @documentationMaturity preview\n * @param field - Field to check for a value.\n * @requiredField field\n * @returns Refined filter.\n */\n isNotEmpty(field: string): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified field does not exist or does not have any value.\n *\n * The `isEmpty()` method refines this filter to only match items where the\n * value of the specified field is `null` or `undefined` or the field does\n * not exist.\n *\n * If the field contains any value at all for a given item, including the\n * empty string or an invalid value, that item will match the filter.\n * @public\n * @documentationMaturity preview\n * @param field - Field to check for a value.\n * @requiredField field\n * @returns An object representing the refined filter.\n */\n isEmpty(field: string): WixDataFilter\n\n /**\n * Refines a filter to match items where the value of the specified field starts with a specified value.\n *\n * The `startsWith()` method refines this filter to only match items where the value of the specified field starts with the specified value. Matching with `startsWith()` is not case sensitive, so specifying `\"TEXT\"` is considered to start with `\"tex\"`.\n *\n * You can only use `startsWith()` with a [field of type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data) string or reference. When specifying a field of type reference, `startsWith()` matches by the ID of the referenced item as a string.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the specified value.\n * @requiredField field\n * @param value - Value to look for at the beginning of the specified field value.\n * @requiredField value\n * @returns Refined filter.\n */\n startsWith(field: string, value: string): WixDataFilter\n\n /**\n * Refines a filter to match items where the value of the specified field ends with a specified value.\n *\n * The `endsWith()` method refines this filter to only match items where the value of the specified field ends with the specified value. Matching with `endsWith()` is not case sensitive, so `\"TEXT\"` is considered to end with `\"ext\"`.\n *\n * You can only use `endsWith()` with a [field of type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data) string or reference. When specifying a field of type reference, `endsWith()` matches by the ID of the referenced item as a string.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the specified value.\n * @requiredField field\n * @param value - Value to look for at the end of the specified field value.\n * @requiredField value\n * @returns Refined filter.\n */\n endsWith(field: string, value: string): WixDataFilter\n\n /**\n * Refines a filter to match items where the value of the specified field contains the specified value.\n *\n * The `contains()` method refines the filter to only match items for which the value of the specified field contains the specified value. `contains()` is not case-sensitive, so the value `sunday` is considered to contain the value `Sun`.\n *\n * You can use `contains()` with a [field of type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data) is a string or a reference. When specifying a field of type reference, `contains()` matches by the ID of the referenced item as a string. To compare by other data types, use the [`eq()`](https://dev.wix.com/docs/sdk/backend-modules/data/wix-data-items-sdk-1-0-0/wix-data-filter/eq) method.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the provided value.\n * @requiredField field\n * @param value - Value to locate in the specified field.\n * @requiredField value\n * @returns Refined filter.\n */\n contains(field: string, value: string): WixDataFilter\n\n /**\n * Refines a filter to match items where the values of the specified field contain any of the specified values.\n *\n * The `hasSome()` method refines this filter to only match items where the specified field contains any of the specified values.\n *\n * Matching strings with `hasSome()` is case sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If the value of the specified field is an array, `hasSome()` will match\n * if any of the elements of that array match any of the specified values.\n *\n * If the specified field contains multiple references, pass item IDs in the\n * `value` field. In such a case, `hasSome()` will match if any of the\n * multiple references match any of the specified ID values.\n *\n * You can specify a list of values to match by providing an array of\n * String, Number, or Date types as the `value` parameters.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param values - Values to match.\n * @requiredField values\n * @returns An object representing the refined filter.\n */\n hasSome(field: string, ...values: string[] | number[] | Date[]): WixDataFilter\n\n /**\n * Overload for `hasSome()`\n * @public\n * @documentationMaturity preview\n */\n hasSome(field: string, values: string[] | number[] | Date[]): WixDataFilter\n\n /**\n * Refines a filter to match items where the values of the specified field contain all of the specified values.\n *\n * The `hasAll()` method refines this filter to only match items where the specified field contains all of the specified values.\n *\n * Matching strings with `hasAll()` is case sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If the value of the specified field is an array, `hasAll()` will match\n * if there is a match in the elements of that array for all of the specified\n * values.\n *\n * You can specify a list of values to match by providing an array of\n * String, Number, or Date types as the `value` parameters.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `values`.\n * @requiredField field\n * @param values - Values to match.\n * @requiredField values\n * @returns An object representing the refined filter.\n */\n hasAll(field: string, ...values: string[] | number[] | Date[]): WixDataFilter\n\n /**\n * Overload for `hasAll()`\n * @public\n * @documentationMaturity preview\n */\n hasAll(field: string, values: string[] | number[] | Date[]): WixDataFilter\n\n /**\n * Adds an `or` condition to the filter.\n *\n * The `or()` method adds an inclusive `or` condition to this filter. A filter\n * with an `or` returns all the items that match the filter as defined up to\n * the `or` method, the items that match the filter passed to the `or`\n * method, and the items that match both.\n *\n * The `or()` method is designed to work with 2 or more queries or filters.\n * If you use it on its own, it will return all the items in a collection.\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial filter as an `or` condition.\n * @requiredField filter\n * @returns Object representing the refined filter.\n */\n or(filter: WixDataFilter): WixDataFilter\n\n /**\n * Adds an `and` condition to the filter.\n *\n * A filter with an `and` condition returns all items that meet the conditions defined on both sides of the condition.\n *\n * Use the `and()` method when performing compound queries. For example, the final filter in this set of\n * queries returns results where status is either pending or rejected **and** age is either less than 25 or greater\n * than 65.\n *\n * ```js\n * let statusFilter = items.filter()\n * .eq(\"status\", \"pending\")\n * .or(items.filter().eq(\"status\", \"rejected\"));\n *\n * let ageFilter = items.filter()\n * .lt(\"age\", 25)\n * .or(items.filter().gt(\"age\", 65));\n *\n * let statusAndAgeFilter = statusFilter.and(ageFilter);\n * ```\n *\n * > **Notes**:\n * > - The `and()` method is designed to work with 2 or more queries or filters. If used with a single query or filter, it returns all items in a collection.\n * > - When chaining multiple `WixDataFilter` methods to a filter, an `and` condition is implied. In such cases, you do not need to call the `and()` method explicitly. For example, this filter returns results where an item `status` is `active` and `age` is greater than 25:\n * > ```js\n * > items.filter().eq(\"status\", \"active\").gt(\"age\", 25);\n * > ```\n *\n * @public\n * @documentationMaturity preview\n * @param filter - `WixDataFilter` used with an `and` condition.\n * @requiredField filter\n * @returns The compound filter.\n */\n and(filter: WixDataFilter): WixDataFilter\n\n /**\n * Adds a `not` condition to the filter.\n *\n * The `not()` method adds a `not` condition to this filter. A filter with a `not`\n * returns all the items that match the filter as defined up to the `not`\n * method, but don't match the filter passed to the `not` method.\n *\n * If the filter only contains a `not()` method, it returns all the items\n * that don't match the filter defined by the `not` method.\n *\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial filter as a `not` condition.\n * @requiredField filter\n * @returns Object representing the refined filter.\n */\n not(filter: WixDataFilter): WixDataFilter\n\n /**\n * Refines a filter to match items where the value of the specified field is within the defined range.\n *\n * The `between()` method refines this filter to match items for which the value of the specified field is greater than or equal to `rangeStart` and less than `rangeEnd`. The method only compares values of [the same type](https://support.wix.com/en/article/cms-formerly-content-manager-about-your-collection-fields#field-type).\n *\n * The following types can be compared:\n * - Number: Compared numerically.\n * - Date: Compared as JavaScript Date objects.\n * - String: Compared lexicographically:\n * - `\"A\"` and `\"M\"` are considered between `\"A\"` and `\"Z\"`, but `\"a\"`, `\"m\"`, `\"z\"` and `\"Z\"` are not.\n * - `\"A\"`, `\"M\"`, `\"Z\"`, and `\"a\"` are considered between `\"A\"` and `\"z\"`, but `\"z\"` is not.\n *\n * > **Note**: Items that do not have a value for the specified field are considered as the lowest comparable value and are ranked last.\n *\n * @public\n * @documentationMaturity preview\n * @param field - Field to compare with `rangeStart` and `rangeEnd`.\n * @requiredField field\n * @param rangeStart - Starting value of the range to match.\n * @requiredField rangeStart\n * @param rangeEnd - Ending value of the range to match.\n * @requiredField rangeEnd\n * @returns Refined filter.\n */\n between(\n field: string,\n rangeStart: string | number | Date,\n rangeEnd: string | number | Date\n ): WixDataFilter\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../../src/api/WixDataQuery.ts"],"sourcesContent":["import { WixDataQueryOptions, WixDataReadOptions } from './types'\nimport { WixDataResult } from './WixDataResult'\nimport { WixDataFilter } from './WixDataFilter'\n\n/**\n * @builder\n */\nexport interface WixDataQuery {\n /**\n * Adds a sort to a query or sort, sorting by the specified properties in descending order.\n *\n * The `descending()` method refines this query to sort in descending order of the specified properties. If you\n * specify more than one property, descending() sorts the results in descending order by each property in the order\n * they are listed.\n *\n * You can sort the following types:\n *\n * Number: Sorts numerically.\n * - Date: Sorts by date and time.\n * - String: Sorts lexicographically, so `\"abc\"` comes before `\"XYZ\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n *\n * If a property contains a number as a String, that value is sorted alphabetically and not numerically. Items\n * that do not have a value for the specified sort property are ranked lowest.\n * @public\n * @documentationMaturity preview\n * @param fields - Fields used in the sort.\n * @requiredField fields\n * @returns Refined query.\n */\n descending(...fields: string[]): WixDataQuery\n\n descending(fields: string[]): WixDataQuery\n\n descending(...fields: any): WixDataQuery\n\n /**\n * Adds a sort to a query or sort, sorting by the specified properties in ascending order.\n *\n * The `ascending()` method refines this query in ascending order of the specified properties. If you specify more\n * than one property, `ascending()` sorts the results in ascending order by each property in the order they are listed.\n *\n * You can sort the following types:\n * - Number: Sorts numerically.\n * - Date: Sorts by date and time.\n * - String: Sorts lexicographically, so `\"abc\"` comes after `\"XYZ\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n *\n * If a property contains a number as a String, that value is sorted alphabetically and not numerically.\n * Items that do not have a value for the specified sort property are ranked lowest.\n * @public\n * @documentationMaturity preview\n * @param fields - Fields used in the sort.\n * @requiredField fields\n * @returns Refined query.\n */\n ascending(...fields: string[]): WixDataQuery\n\n ascending(fields: string[]): WixDataQuery\n\n ascending(...fields: any): WixDataQuery\n\n /**\n * Refines a query to match items whose specified property value equals the specified value.\n *\n * The `eq()` method refines this query to only\n * match items where Value of the specified property equals the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * Matching strings with `eq()` is case sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If `field` points to a collection field of type array, `eq()` includes the item\n * as long as at least one array element matches the specified `value`.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns Refined query.\n */\n eq(field: string, value: any): WixDataQuery\n\n /**\n * Refines a query to match items whose specified property value does not equal the specified value.\n *\n * The `ne()` method refines this query to only\n * match items where the value of the specified property does not equal the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type is considered not equal to the same number stored as a Number type.\n *\n * Matching strings with `ne()` is case sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If the value of the `field` property is an array, `ne()` includes items\n * in which none of the elements of the array match the specified `value`.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns Refined query.\n */\n ne(field: string, value: any): WixDataQuery\n\n /**\n * Refines a query to match items whose specified property value is greater than or equal to the specified\n * value.\n *\n * The `ge()` method refines this query to only\n * match items where the value of the specified property is greater than or\n * equal to the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * If a property contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified property are ranked lowest.\n *\n * The following types of properties can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically,\n * so `\"abc\"` is greater than or equal to `\"ABC\"` (because of the greater than),\n * but `\"ABC\"` is not greater than or equal to `\"abc\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns Refined query.\n */\n ge(field: string, value: string | number | Date): WixDataQuery\n\n /**\n * Refines a query to match items whose specified property value is greater than the specified value.\n *\n * The `gt()` method refines this query to only match\n * items where the value of the specified property is greater than the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * If a property contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified property are ranked lowest.\n *\n * The following types of properties can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"text\"` is greater than `\"Text\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns An object with the query definition, based on the supplied parameters.\n */\n gt(field: string, value: string | number | Date): WixDataQuery\n\n /**\n * Refines a query to match items whose specified property value is less than or equal to the specified\n * value.\n *\n * The `le()` method refines this query to only match\n * items where the value of the specified property is less than or equal to the\n * specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * If a property contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified property are ranked lowest.\n *\n * The following types of properties can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically,\n * so `\"ABC\"` is less than or equal to `\"abc\"` (because of the less than),\n * but `\"abc\"` is not less than or equal to `\"ABC\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns Refined query.\n */\n le(field: string, value: string | number | Date): WixDataQuery\n\n /**\n * Refines a query to match items whose specified property value is less than the specified value.\n *\n * The `lt()` method refines this query to only match\n * items where the value of the specified property is less than the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * If a property contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified property are ranked lowest.\n *\n * The following types of properties can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"Text\"` is less than `\"text\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns An object with the query definition, based on the supplied parameters.\n */\n lt(field: string, value: string | number | Date): WixDataQuery\n\n /**\n * Refines a query to match items whose specified property has any value.\n *\n * The `isNotEmpty()` method refines this query to only match items where the\n * value of the specified property is not `null` or `undefined`.\n *\n * If the property contains any value at all for a given item, including the\n * empty string or an invalid value, that item will match the query.\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to check for a value.\n * @requiredField field\n * @returns Refined query.\n */\n isNotEmpty(field: string): WixDataQuery\n\n /**\n * Refines a query to match items whose specified property does not exist or does not have any value.\n *\n * The `isEmpty()` method refines this query to only match items where the\n * value of the specified property is `null` or `undefined` or the property does\n * not exist.\n *\n * If the property contains any value at all for a given item, including the\n * empty string or an invalid value, that item will match the query.\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to check for a value.\n * @requiredField field\n * @returns Refined query.\n */\n isEmpty(field: string): WixDataQuery\n\n /**\n * Refines a query to match items whose specified property value starts with a specified string.\n *\n * The `startsWith()` method refines this query to\n * only match items where the value of the specified property starts with the\n * defined `string`. Matching with `startsWith()` is not case sensitive, so `\"TEXT\"` starts\n * with `\"tex\"`.\n *\n * You can only use `startsWith()` with a property whose value is a String or Reference.\n * When using a Reference, `startsWith()` matches by the ID of the referenced item as Strings.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the `value` parameter.\n * @requiredField field\n * @param value - String to look for at the beginning of the specified property value.\n * @requiredField value\n * @returns `WixDataQuery` object representing the refined query.\n */\n startsWith(field: string, value: string): WixDataQuery\n\n /**\n * Refines a query to match items whose specified property value ends with a specified string.\n *\n * The `endsWith()` method refines this query to only\n * match items where the value of the specified property ends with the specified\n * `string`. Matching with `endsWith()` is not case sensitive, so `\"TEXT\"` ends\n * with `\"ext\"`.\n *\n * You can only use `endsWith()` with a property whose value is a String or Reference.\n * When using a Reference, `endsWith()` matches by the ID of the referenced item as Strings.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the string.\n * @requiredField field\n * @param value - String to look for at the end of the specified property value.\n * @requiredField value\n * @returns `WixDataQuery` object representing the refined query.\n */\n endsWith(field: string, value: string): WixDataQuery\n\n /**\n * Refines a query to match items whose specified property value contains a specified string.\n *\n * The `contains()` method refines this query to\n * only match items where the value of the specified property contains the\n * specified `string`. Matching with `contains()` is not case sensitive, so\n * `\"text\"` does contain `\"Tex\"`.\n *\n * You can use `contains()` with a property whose value is a String or a Reference.\n * For properties of type reference it is recommended that you use the [`eq()`](#eq)\n * method instead of `contains()`. With properties that are References, `contains()`\n * matches by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the string.\n * @requiredField field\n * @param value - The string to look for inside the specified property value.\n * @requiredField value\n * @returns Refined query.\n */\n contains(field: string, value: string): WixDataQuery\n\n /**\n * Refines a query to match items whose specified property value equals any of the specified `values`\n * parameters.\n *\n * The `hasSome()` method refines this query to\n * only match items where the value of the specified property equals any of\n * the specified values.\n *\n * Matching strings with `hasSome()` is case sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If the value of the specified property is an array, `hasSome()` will match\n * if any of the elements of that array match any of the specified values.\n *\n * If the specified property contains multiple references, pass item IDs in the\n * `value` property. In such a case, `hasSome()` will match if any of the\n * multiple references match any of the specified ID values.\n *\n * You can specify a list of values to match by providing an array of\n * String, Number, or Date types as the `value` parameters.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param values - Values to match.\n * @requiredField values\n * @returns Refined query.\n */\n hasSome(field: string, ...values: string[] | number[] | Date[]): WixDataQuery\n\n /**\n * Overload for `hasSome()`\n * @public\n * @documentationMaturity preview\n */\n hasSome(field: string, values: string[] | number[] | Date[]): WixDataQuery\n\n /**\n * Refines a query to match items whose specified property values equals all of the specified `value`\n * parameters.\n *\n * The `hasAll()` method refines this query to\n * only match items where the value of the specified property equals all of\n * the specified values.\n *\n * Matching strings with `hasAll()` is case sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If the value of the specified property is an array, `hasAll()` will match\n * if there is a match in the elements of that array for all of the specified\n * values.\n *\n * You can specify a list of values to match by providing an array of\n * String, Number, or Date types as the `value` parameters.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param values - Values to match.\n * @requiredField values\n * @returns Refined query.\n */\n hasAll(field: string, ...values: string[] | number[] | Date[]): WixDataQuery\n\n /**\n * Overload for `hasAll()`\n * @public\n * @documentationMaturity preview\n */\n hasAll(field: string, values: string[] | number[] | Date[]): WixDataQuery\n\n /**\n * Adds an `or` condition to the query or filter.\n *\n * The `or()` method adds an inclusive `or` condition to this filter. A query or filter\n * with an `or` returns all the items that match the query or filter as defined up to\n * the `or` method, the items that match the query or filter passed to the `or`\n * method, and the items that match both.\n *\n * The `or()` method is designed to work with 2 or more queries or filters. Used on its own, it returns all the items in a collection.\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial filter as an `or` condition.\n * @requiredField filter\n * @returns Refined query.\n */\n or(filter: WixDataFilter): WixDataQuery\n\n /**\n * Adds an `and` condition to the query or filter.\n *\n * The `and()` method adds an and condition to this query. A query or filter with an `and` returns all the items\n * that match the query or filter as defined up to the `and` method and also match the query or filter passed to\n * the `and` method.\n *\n * Note that when chaining multiple `WixDataFilter` methods to a query an and condition is assumed. In such cases,\n * you do not need to add a call to the `and()` method. For example, this query returns results where status is\n * active **and** age is greater than 25.\n * ```js\n * items.query(\"myCollection\").eq(\"status\", \"active\").gt(\"age\", 25);\n * ```\n *\n * The `and()` method is needed when performing compound queries. For example, the final query in this set of\n * queries returns results where status is either pending or rejected **and** age is either less than 25 or greater\n * than 65.\n * ```js\n * let statusQuery = items\n * .query(\"myCollection\")\n * .eq(\"status\", \"pending\")\n * .or(items.filter().eq(\"status\", \"rejected\"));\n *\n * let ageQuery = items\n * .filter()\n * .lt(\"age\", 25)\n * .or(items.filter().gt(\"age\", 65));\n *\n * let statusAndAgeQuery = statusQuery.and(ageQuery);\n * ```\n *\n * The `and()` method is designed to work with 2 or more queries or filters. When used on its own, it returns all the items in a collection.\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial query as an `and` condition.\n * @requiredField filter\n * @returns Refined query.\n */\n and(filter: WixDataFilter): WixDataQuery\n\n /**\n * Adds a `not` condition to the query or filter.\n *\n * The `not()` method adds a `not` condition to this query. A query with a `not`\n * returns all the items that match the query as defined up to the `not`\n * method, but don't match the filter passed to the `not` method.\n *\n * If the query only contains a `not()` method, it returns all the items\n * that don't match the filter defined by the `not` method.\n *\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial filter as a `not` condition.\n * @requiredField filter\n * @returns Refined query.\n */\n not(filter: WixDataFilter): WixDataQuery\n\n /**\n * Refines a query to match items whose specified property value is within a specified range.\n *\n * The `between()` method refines this query to only match items where the value of the specified property is\n * greater than or equal to `rangeStart` and less than `rangeEnd`.\n *\n * It only matches values of the same type. For example, a number value stored as a String type does not match the\n * same number stored as a Number type.\n *\n * If a property contains a number as a String, that value is compared alphabetically and not numerically. Items\n * that do not have a value for the specified property are ranked lowest.\n *\n * The following types of properties can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so\n * - `\"A\"` and `\"M\"` are between `\"A\"` and `\"Z\"`, but `\"a\"`, `\"m\"`, `\"z\"` and `\"Z\"` are not.\n * - `\"A\"`, `\"M\"`, `\"Z\"`, and `\"a\"` are between `\"A\"` and `\"z\"`, but `\"z\"` is not.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with rangeStart and rangeEnd.\n * @requiredField field\n * @param rangeStart - Starting value of the range to match.\n * @requiredField rangeStart\n * @param rangeEnd - Ending value of the range to match.\n * @requiredField rangeEnd\n * @returns Refined query.\n */\n between(\n field: string,\n rangeStart: string | number | Date,\n rangeEnd: string | number | Date\n ): WixDataQuery\n\n /**\n * Returns the number of items that match the query.\n *\n * The `count()` method returns a Promise that resolves to the number of\n * items that match the query. The Promise is rejected if `count()` is called\n * with incorrect permissions or if any of the methods used to refine the\n * query is invalid.\n *\n * Calling the `count()` method triggers the [`beforeCount()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/before-count) and [`afterCount()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/after-count) hooks if they have been defined.\n *\n * Use the `options` parameter to run `count()` without checking for permissions\n * or without its registered hooks.\n *\n * Any method that does not filter query results (e.g., [`ascending()`](#ascending))\n * does not affect the result of `count()`.\n *\n * If you build a query and don't refine it with any `WixDataQuery` methods,\n * `count()` returns the total number of items in the collection.\n *\n * > **Note**: You can also retrieve the number of query results by calling `find()` and setting the `options.returnTotalCount` property to `true`.\n *\n * @public\n * @documentationMaturity preview\n * @param options - Options to use when processing this operation.\n * @returns Number of items that match the query.\n */\n count(options?: WixDataReadOptions): Promise<number>\n\n /**\n * Returns the distinct values that match the query, without duplicates.\n *\n * The `distinct()` method returns a Promise that resolves to:\n * - The distinct values found in the specified field when running the query.\n * - Additional information about the results, such as the number of values that match the query.\n *\n * Unlike `find()`, which returns all item objects that match the query, `distinct()` returns matching field values,\n * and eliminates duplicate field values from the query result. You cannot use `find()` and `distinct()` together.\n *\n * For an item to be resolved as distinct, only the specified field must be distinct. Other fields for that item in\n * the collection are not evaluated when resolving the promise.\n *\n * The Promise is rejected if `distinct()` is called with incorrect permissions or if any of the\n * methods used to refine the query is invalid.\n *\n * >**Note:** Only site visitors with [Data Read](https://support.wix.com/en/article/collection-permissions-an-overview#permissions) permissions can retrieve and view data. You can override the permissions by calling this method with [elevated permissions](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-elevated-permissions).\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared for distinct values.\n * @requiredField field\n * @param options - Configuration options for building the query.\n * @returns Promise that resolves to the results of the query.\n */\n distinct(\n field: string,\n options?: WixDataQueryOptions\n ): Promise<WixDataResult<any>>\n\n /**\n * Returns the items that match the query.\n *\n * The `find()` method returns a Promise that resolves to the results found\n * by the query and some information about the results. The Promise is\n * rejected if `find()` is called with incorrect permissions or if any of the\n * methods used to refine the query is invalid.\n *\n * Calling the `find()` method triggers the [`beforeQuery()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/before-query) and [`afterQuery()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/after-query) hooks if they have been defined.\n *\n * > **Note:**\n * > Calling `find()` triggers hooks for the specified collection only. It doesn't trigger hooks for referenced collections.\n *\n * Use the `options` parameter to override default preferences:\n * - Ensure the most up-to-date data is retrieved with `consistentRead`.\n * - Prevent hooks from running with `suppressHooks`.\n * - Get a count of all the items that match the query by setting `returnTotalCount` to `true`.\n *\n * If you build a query and don't refine it with any `wixDataQuery` methods,\n * `find()` returns the entire collection.\n * @public\n * @documentationMaturity preview\n * @param options - Configuration options for building the query.\n * @returns Promise that resolves to the results of the query.\n */\n find(options?: WixDataQueryOptions): Promise<WixDataResult>\n\n /**\n * Lists the fields to return in a query's results.\n *\n * The `fields()` method returns only the specified fields in the query's results.\n *\n * You can use `include()` in conjunction with `fields()` to get referenced items.\n *\n * When `fields()` receives an empty or invalid property, the query behaves as follows:\n * - When no fields are specified, the query returns all fields.\n * - When multiple fields are specified but some are invalid, invalid fields are ignored and valid fields are returned.\n * - When only invalid fields are specified, only the default `_id` field is returned.\n * @public\n * @documentationMaturity preview\n * @param fields - Properties to return.\n * @requiredField fields\n * @returns A `WixDataQuery` object representing the query.\n */\n fields(...fields: string[]): WixDataQuery\n\n /**\n * Limits the number of items the query returns.\n *\n * The `limit()` method defines the number of results a query returns in each\n * page. Only one page of results is retrieved at a time. The `next()`\n * and `prev()` methods are used to\n * navigate the pages of a query result.\n *\n * By default, `limit` is set to `50`.\n *\n * The maximum value that `limit()` can accept is `1000`.\n *\n * Note that for some [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code), the maximum value `limit()` can accept is\n * less than `1000`. For example, the maximum limit for the Wix `Stores/Product` collection is 100.\n * @public\n * @documentationMaturity preview\n * @param limitNumber - Number of items to return, which is also the `pageSize` of the results object.\n * @requiredField limitNumber\n * @returns `WixDataQuery` object representing the refined query.\n */\n limit(limitNumber: number): WixDataQuery\n\n /**\n * Sets the number of items to skip before returning query results.\n *\n * The `skip()` method defines the number of results to skip in the query\n * results before returning new query results.\n *\n * For example, if you query a collection and 50 items match your query, but\n * you set `skip` to 10, the results returned will skip the first 10 items\n * that match and return the 11th through 50th items.\n *\n * By default, `skip` is set to 0.\n * @public\n * @documentationMaturity preview\n * @param skipCount - Number of items to skip in the query results before returning the results.\n * @requiredField skipCount\n * @returns `WixDataQuery` object representing the refined query.\n */\n skip(skipCount: number): WixDataQuery\n\n /**\n * Includes referenced items for the specified properties in a query's results.\n *\n * The `include()` method refines a query so that the items returned in the\n * query's results include the full referenced items for the specified properties.\n *\n * For example, suppose you have a **books** collection with an **author**\n * field that references an **authors** collection. Querying the **books**\n * collection with an `include(\"author\")` returns the relevant book items\n * and each item will include the full referenced author item in the book's\n * `author` property.\n *\n * When querying a collection that contains a reference field without using the\n * `include()` method:\n * - Single reference field: returned items contain only the ID of the\n * referenced item, and not the full referenced items.\n * - Multiple reference field: returned items do not contain the multiple\n * reference field at all.\n *\n * When including a property with multiple references, the following limitations\n * apply:\n * - Only one property with multiple references can be included.\n * - The query will return an error if more than 50 items are returned, regardless\n * of any query limit set using the `limit()` method.\n * - Each returned item can include up to 50 referenced items. If there are more\n * than 50 referenced items, only 50 are returned when the query is run\n * and the `partialIncludes`\n * property of the returned `WixDataQueryResult`\n * is `true`. To retrieve more than 50 referenced items, use the\n * `queryReferenced()` method.\n *\n * For a discussion of when to use the similar `queryReferenced()`\n * method and when to use `include()`, see [Querying Items that Reference Other Items](https://support.wix.com/en/article/including-referenced-data-when-filtering).\n *\n * > **Note:** The `include()` method is not supported for [single-item collections](https://support.wix.com/en/article/cms-adding-and-setting-up-a-single-item-collection).\n *\n * @public\n * @documentationMaturity preview\n * @param fields - Fields for which to include referenced items.\n * @requiredField fields\n * @returns A `WixDataQuery` object representing the query.\n */\n include(...fields: string[]): WixDataQuery\n\n /**\n * Overload for `include()`\n * @public\n * @documentationMaturity preview\n */\n include(field: string, limit?: number): WixDataQuery\n\n /**\n * Overload for `include()`\n * @public\n * @documentationMaturity preview\n */\n include(field1: string, field2: string, limit?: number): WixDataQuery\n\n /**\n * Overload for `include()`\n * @public\n * @documentationMaturity preview\n */\n include(\n field1: string,\n field2: string,\n field3: string,\n limit?: number\n ): WixDataQuery\n\n /**\n * Overload for `include()`\n * @public\n * @documentationMaturity preview\n */\n include(\n field1: string,\n field2: string,\n field3: string,\n field4: string,\n limit?: number\n ): WixDataQuery\n\n /**\n * Overload for `include()`\n * @public\n * @documentationMaturity preview\n */\n include(\n field1: string,\n field2: string,\n field3: string,\n field4: string,\n field5: string,\n limit?: number\n ): WixDataQuery\n\n /**\n * Overload for `include()`\n * @public\n * @documentationMaturity preview\n */\n include(...fieldNamesAndLimit: [...string[], number]): WixDataQuery\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/api/WixDataQuery.ts"],"sourcesContent":["import { WixDataQueryOptions, WixDataReadOptions } from './types'\nimport { WixDataResult } from './WixDataResult'\nimport { WixDataFilter } from './WixDataFilter'\n\n/**\n * @builder\n */\nexport interface WixDataQuery {\n /**\n * Adds a sort to a query or sort, sorting by the specified properties in descending order.\n *\n * The `descending()` method refines this query to sort in descending order of the specified properties. If you\n * specify more than one property, descending() sorts the results in descending order by each property in the order\n * they are listed.\n *\n * You can sort the following types:\n *\n * Number: Sorts numerically.\n * - Date: Sorts by date and time.\n * - String: Sorts lexicographically, so `\"abc\"` comes before `\"XYZ\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n *\n * If a property contains a number as a String, that value is sorted alphabetically and not numerically. Items\n * that do not have a value for the specified sort property are ranked lowest.\n * @public\n * @documentationMaturity preview\n * @param fields - Fields to sort by.\n * @requiredField fields\n * @returns Refined query.\n */\n descending(...fields: string[]): WixDataQuery\n\n descending(fields: string[]): WixDataQuery\n\n descending(...fields: any): WixDataQuery\n\n /**\n * Adds a sort to a query or sort, sorting by the specified properties in ascending order.\n *\n * The `ascending()` method refines this query in ascending order of the specified properties. If you specify more\n * than one property, `ascending()` sorts the results in ascending order by each property in the order they are listed.\n *\n * You can sort the following types:\n * - Number: Sorts numerically.\n * - Date: Sorts by date and time.\n * - String: Sorts lexicographically, so `\"abc\"` comes after `\"XYZ\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n *\n * If a property contains a number as a String, that value is sorted alphabetically and not numerically.\n * Items that do not have a value for the specified sort property are ranked lowest.\n * @public\n * @documentationMaturity preview\n * @param fields - Fields to sort by.\n * @requiredField fields\n * @returns Refined query.\n */\n ascending(...fields: string[]): WixDataQuery\n\n ascending(fields: string[]): WixDataQuery\n\n ascending(...fields: any): WixDataQuery\n\n /**\n * Refines a query to match items whose specified property value equals the specified value.\n *\n * The `eq()` method refines this query to only\n * match items where Value of the specified property equals the specified `value`.\n *\n * The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data). For example, a number value stored\n * as a number does not match the same number stored as a string.\n *\n * Matching strings with `eq()` is case sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If `field` points to a collection field of type array, `eq()` includes the item\n * as long as at least one array element matches the specified `value`.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns Refined query.\n */\n eq(field: string, value: any): WixDataQuery\n\n /**\n * Refines a query to match items whose specified property value does not equal the specified value.\n *\n * The `ne()` method refines this query to only\n * match items where the value of the specified property does not equal the specified `value`.\n *\n * The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data). For example, a number value stored\n * as a number is considered not equal to the same number stored as a string.\n *\n * Matching strings with `ne()` is case sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If the value of the `field` property is an array, `ne()` includes items\n * in which none of the elements of the array match the specified `value`.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns Refined query.\n */\n ne(field: string, value: any): WixDataQuery\n\n /**\n * Refines a query to match items whose specified property value is greater than or equal to the specified\n * value.\n *\n * The `ge()` method refines this query to only\n * match items where the value of the specified property is greater than or\n * equal to the specified `value`.\n *\n * The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data). For example, a number value stored\n * as a number does not match the same number stored as a string.\n *\n * If a property contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified property are ranked lowest.\n *\n * The following types of properties can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically,\n * so `\"abc\"` is greater than or equal to `\"ABC\"` (because of the greater than),\n * but `\"ABC\"` is not greater than or equal to `\"abc\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns Refined query.\n */\n ge(field: string, value: string | number | Date): WixDataQuery\n\n /**\n * Refines a query to match items whose specified property value is greater than the specified value.\n *\n * The `gt()` method refines this query to only match\n * items where the value of the specified property is greater than the specified `value`.\n *\n * The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data). For example, a number value stored\n * as a number does not match the same number stored as a string.\n *\n * If a property contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified property are ranked lowest.\n *\n * The following types of properties can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"text\"` is greater than `\"Text\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns An object with the query definition, based on the supplied parameters.\n */\n gt(field: string, value: string | number | Date): WixDataQuery\n\n /**\n * Refines a query to match items whose specified property value is less than or equal to the specified\n * value.\n *\n * The `le()` method refines this query to only match\n * items where the value of the specified property is less than or equal to the\n * specified `value`.\n *\n * The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data). For example, a number value stored\n * as a number does not match the same number stored as a string.\n *\n * If a property contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified property are ranked lowest.\n *\n * The following types of properties can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically,\n * so `\"ABC\"` is less than or equal to `\"abc\"` (because of the less than),\n * but `\"abc\"` is not less than or equal to `\"ABC\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns Refined query.\n */\n le(field: string, value: string | number | Date): WixDataQuery\n\n /**\n * Refines a query to match items whose specified property value is less than the specified value.\n *\n * The `lt()` method refines this query to only match\n * items where the value of the specified property is less than the specified `value`.\n *\n * The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data). For example, a number value stored\n * as a number does not match the same number stored as a string.\n *\n * If a property contains a number as a string, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified property are ranked lowest.\n *\n * The following types of properties can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"Text\"` is less than `\"text\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns An object with the query definition, based on the supplied parameters.\n */\n lt(field: string, value: string | number | Date): WixDataQuery\n\n /**\n * Refines a query to match items whose specified property has any value.\n *\n * The `isNotEmpty()` method refines this query to only match items where the\n * value of the specified property is not `null` or `undefined`.\n *\n * If the property contains any value at all for a given item, including the\n * empty string or an invalid value, that item will match the query.\n * @public\n * @documentationMaturity preview\n * @param field - Field to check for a value.\n * @requiredField field\n * @returns Refined query.\n */\n isNotEmpty(field: string): WixDataQuery\n\n /**\n * Refines a query to match items whose specified property does not exist or does not have any value.\n *\n * The `isEmpty()` method refines this query to only match items where the\n * value of the specified property is `null` or `undefined` or the property does\n * not exist.\n *\n * If the property contains any value at all for a given item, including the\n * empty string or an invalid value, that item will match the query.\n * @public\n * @documentationMaturity preview\n * @param field - Field to check for a value.\n * @requiredField field\n * @returns Refined query.\n */\n isEmpty(field: string): WixDataQuery\n\n /**\n * Refines a query to match items whose specified property value starts with a specified value.\n *\n * The `startsWith()` method refines this query to only match items where the value of the specified field starts with the specified value. Matching with `startsWith()` is not case sensitive, so `\"TEXT\"` is considered to start with `\"tex\"`.\n *\n * You can only use `startsWith()` with a [field of type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data) string or reference. When specifying a field of type reference, `startsWith()` matches by the ID of the referenced item as a string.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the specified value.\n * @requiredField field\n * @param value - String to look for at the beginning of the specified property value.\n * @requiredField value\n * @returns `WixDataQuery` object representing the refined query.\n */\n startsWith(field: string, value: string): WixDataQuery\n\n /**\n * Refines a query to match items whose specified property value ends with a specified value.\n *\n * The `endsWith()` method refines this query to only match items where the value of the specified field ends with the specified value. Matching with `endsWith()` is not case sensitive, so `\"TEXT\"` is considered to end with `\"ext\"`.\n *\n * You can only use `endsWith()` with a [field of type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data) string or reference. When specifying a field of type reference, `endsWith()` matches by the ID of the referenced item as a string.\n *\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the specified value.\n * @requiredField field\n * @param value - String to look for at the end of the specified property value.\n * @requiredField value\n * @returns `WixDataQuery` object representing the refined query.\n */\n endsWith(field: string, value: string): WixDataQuery\n\n /**\n * Refines a query to match items whose specified field value contains a specified value.\n *\n * The `contains()` method refines this query to only match items where the value of the specified field contains the specified value. Matching with `contains()` is not case sensitive, so `\"text\"` does contain `\"Tex\"`.\n *\n * You can use `contains()` with a [field of type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data) string or reference. When specifying a field of type reference, `contains()` matches by the ID of the referenced item as a string.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the specified value.\n * @requiredField field\n * @param value - The string to look for inside the specified field value.\n * @requiredField value\n * @returns Refined query.\n */\n contains(field: string, value: string): WixDataQuery\n\n /**\n * Refines a query to match items where the value of the specified field equals any of the specified values.\n *\n * The `hasSome()` method refines this query to only match items where the value of the specified field equals any of the specified values.\n *\n * Matching strings with `hasSome()` is case sensitive, so `\"text\"` is not considered equal to `\"Text\"`.\n *\n * If the value of the specified field is an array, `hasSome()` matches if any of the elements of that array match any of the specified values.\n *\n * If the specified field contains multiple references, specify their item IDs. In such a case, `hasSome() matches if any of the references match any of the specified IDs.\n *\n * You can specify a list of values to match by providing an array of strings, numbers, or dates.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param values - Values to match.\n * @requiredField values\n * @returns Refined query.\n */\n hasSome(field: string, ...values: string[] | number[] | Date[]): WixDataQuery\n\n /**\n * Overload for `hasSome()`\n * @public\n * @documentationMaturity preview\n */\n hasSome(field: string, values: string[] | number[] | Date[]): WixDataQuery\n\n /**\n * Refines a query to match items whose specified field values equals all of the specified values.\n *\n * The `hasAll()` method refines this query to only match items where the value of the specified field equals all of the specified values.\n *\n * Matching strings with `hasAll()` is case sensitive, so `\"text\"` is not considered equal to `\"Text\"`.\n *\n * If the value of the specified field is an array, `hasAll()` matches if all the specified values match all the elements of the array.\n *\n * You can specify a list of values to match by providing an array of strings, numbers, or dates.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param values - Values to match.\n * @requiredField values\n * @returns Refined query.\n */\n hasAll(field: string, ...values: string[] | number[] | Date[]): WixDataQuery\n\n /**\n * Overload for `hasAll()`\n * @public\n * @documentationMaturity preview\n */\n hasAll(field: string, values: string[] | number[] | Date[]): WixDataQuery\n\n /**\n * Adds an `or` condition to the query or filter.\n *\n * The `or()` method adds an inclusive `or` condition to this filter. A query or filter\n * with an `or` returns all the items that match the query or filter as defined up to\n * the `or` method, the items that match the query or filter passed to the `or`\n * method, and the items that match both.\n *\n * The `or()` method is designed to work with 2 or more queries or filters. Used on its own, it returns all the items in a collection.\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial filter as an `or` condition.\n * @requiredField filter\n * @returns Refined query.\n */\n or(filter: WixDataFilter): WixDataQuery\n\n /**\n * Adds an `and` condition to the query or filter.\n *\n * The `and()` method adds an and condition to this query. A query or filter with an `and` returns all the items\n * that match the query or filter as defined up to the `and` method and also match the query or filter passed to\n * the `and` method.\n *\n * Note that when chaining multiple `WixDataFilter` methods to a query an and condition is assumed. In such cases,\n * you do not need to add a call to the `and()` method. For example, this query returns results where status is\n * active **and** age is greater than 25.\n * ```js\n * items.query(\"myCollection\").eq(\"status\", \"active\").gt(\"age\", 25);\n * ```\n *\n * The `and()` method is needed when performing compound queries. For example, the final query in this set of\n * queries returns results where status is either pending or rejected **and** age is either less than 25 or greater\n * than 65.\n * ```js\n * let statusQuery = items\n * .query(\"myCollection\")\n * .eq(\"status\", \"pending\")\n * .or(items.filter().eq(\"status\", \"rejected\"));\n *\n * let ageQuery = items\n * .filter()\n * .lt(\"age\", 25)\n * .or(items.filter().gt(\"age\", 65));\n *\n * let statusAndAgeQuery = statusQuery.and(ageQuery);\n * ```\n *\n * The `and()` method is designed to work with 2 or more queries or filters. When used on its own, it returns all the items in a collection.\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial query as an `and` condition.\n * @requiredField filter\n * @returns Refined query.\n */\n and(filter: WixDataFilter): WixDataQuery\n\n /**\n * Adds a `not` condition to the query or filter.\n *\n * The `not()` method adds a `not` condition to this query. A query with a `not`\n * returns all the items that match the query as defined up to the `not`\n * method, but don't match the filter passed to the `not` method.\n *\n * If the query only contains a `not()` method, it returns all the items\n * that don't match the filter defined by the `not` method.\n *\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial filter as a `not` condition.\n * @requiredField filter\n * @returns Refined query.\n */\n not(filter: WixDataFilter): WixDataQuery\n\n /**\n * Refines a query to match items whose specified property value is within a specified range.\n *\n * The `between()` method refines this query to only match items where the value of the specified property is\n * greater than or equal to `rangeStart` and less than `rangeEnd`.\n *\n * The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data). For example, a number value stored as a number does not match the same number stored as a string.\n *\n * If a property contains a number as a string, that value is compared alphabetically and not numerically. Items\n * that do not have a value for the specified property are ranked lowest.\n *\n * The following types of properties can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so\n * - `\"A\"` and `\"M\"` are between `\"A\"` and `\"Z\"`, but `\"a\"`, `\"m\"`, `\"z\"` and `\"Z\"` are not.\n * - `\"A\"`, `\"M\"`, `\"Z\"`, and `\"a\"` are between `\"A\"` and `\"z\"`, but `\"z\"` is not.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with rangeStart and rangeEnd.\n * @requiredField field\n * @param rangeStart - Starting value of the range to match.\n * @requiredField rangeStart\n * @param rangeEnd - Ending value of the range to match.\n * @requiredField rangeEnd\n * @returns Refined query.\n */\n between(\n field: string,\n rangeStart: string | number | Date,\n rangeEnd: string | number | Date\n ): WixDataQuery\n\n /**\n * Returns the number of items that match the query.\n *\n * The `count()` method returns a Promise that resolves to the number of\n * items that match the query. The Promise is rejected if `count()` is called\n * with incorrect permissions or if any of the methods used to refine the\n * query is invalid.\n *\n * Calling the `count()` method triggers the [`beforeCount()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/before-count) and [`afterCount()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/after-count) hooks if they have been defined.\n *\n * Use the `options` parameter to run `count()` without checking for permissions\n * or without its registered hooks.\n *\n * Any method that does not filter query results (e.g., [`ascending()`](#ascending))\n * does not affect the result of `count()`.\n *\n * If you build a query and don't refine it with any `WixDataQuery` methods,\n * `count()` returns the total number of items in the collection.\n *\n * > **Note**: You can also retrieve the number of query results by calling `find()` and setting the `options.returnTotalCount` property to `true`.\n *\n * @public\n * @documentationMaturity preview\n * @param options - Options to use when processing this operation.\n * @returns Number of items that match the query.\n */\n count(options?: WixDataReadOptions): Promise<number>\n\n /**\n * Returns the distinct values that match the query, without duplicates.\n *\n * The `distinct()` method returns a Promise that resolves to:\n * - The distinct values found in the specified field when running the query.\n * - Additional information about the results, such as the number of values that match the query.\n *\n * Unlike `find()`, which returns all item objects that match the query, `distinct()` returns matching field values,\n * and eliminates duplicate field values from the query result. You cannot use `find()` and `distinct()` together.\n *\n * For an item to be resolved as distinct, only the specified field must be distinct. Other fields for that item in\n * the collection are not evaluated when resolving the promise.\n *\n * The Promise is rejected if `distinct()` is called with incorrect permissions or if any of the\n * methods used to refine the query is invalid.\n *\n * >**Note:** Only site visitors with [Data Read](https://support.wix.com/en/article/collection-permissions-an-overview#permissions) permissions can retrieve and view data. You can override the permissions by calling this method with [elevated permissions](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-elevated-permissions).\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared for distinct values.\n * @requiredField field\n * @param options - Configuration options for building the query.\n * @returns Promise that resolves to the results of the query.\n */\n distinct(\n field: string,\n options?: WixDataQueryOptions\n ): Promise<WixDataResult<any>>\n\n /**\n * Returns the items that match the query.\n *\n * The `find()` method returns a Promise that resolves to the results found\n * by the query and some information about the results. The Promise is\n * rejected if `find()` is called with incorrect permissions or if any of the\n * methods used to refine the query is invalid.\n *\n * Calling the `find()` method triggers the [`beforeQuery()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/before-query) and [`afterQuery()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/after-query) hooks if they have been defined.\n *\n * > **Note:**\n * > Calling `find()` triggers hooks for the specified collection only. It doesn't trigger hooks for referenced collections.\n *\n * Use the `options` parameter to override default preferences:\n * - Ensure the most up-to-date data is retrieved with `consistentRead`.\n * - Prevent hooks from running with `suppressHooks`.\n * - Get a count of all the items that match the query by setting `returnTotalCount` to `true`.\n *\n * If you build a query and don't refine it with any `wixDataQuery` methods,\n * `find()` returns the entire collection.\n * @public\n * @documentationMaturity preview\n * @param options - Configuration options for building the query.\n * @returns Promise that resolves to the results of the query.\n */\n find(options?: WixDataQueryOptions): Promise<WixDataResult>\n\n /**\n * Lists the fields to return in a query's results.\n *\n * The `fields()` method returns only the specified fields in the query's results.\n *\n * You can use `include()` in conjunction with `fields()` to get referenced items.\n *\n * When `fields()` receives an empty or invalid property, the query behaves as follows:\n * - When no fields are specified, the query returns all fields.\n * - When multiple fields are specified but some are invalid, invalid fields are ignored and valid fields are returned.\n * - When only invalid fields are specified, only the default `_id` field is returned.\n * @public\n * @documentationMaturity preview\n * @param fields - Properties to return.\n * @requiredField fields\n * @returns A `WixDataQuery` object representing the query.\n */\n fields(...fields: string[]): WixDataQuery\n\n /**\n * Limits the number of items the query returns.\n *\n * The `limit()` method defines the number of results a query returns in each\n * page. Only one page of results is retrieved at a time. The `next()`\n * and `prev()` methods are used to\n * navigate the pages of a query result.\n *\n * By default, `limit` is set to `50`.\n *\n * The maximum value that `limit()` can accept is `1000`.\n *\n * Note that for some [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code), the maximum value `limit()` can accept is\n * less than `1000`. For example, the maximum limit for the Wix `Stores/Product` collection is 100.\n * @public\n * @documentationMaturity preview\n * @param limitNumber - Number of items to return, which is also the `pageSize` of the results object.\n * @requiredField limitNumber\n * @returns `WixDataQuery` object representing the refined query.\n */\n limit(limitNumber: number): WixDataQuery\n\n /**\n * Sets the number of items to skip before returning query results.\n *\n * The `skip()` method defines the number of results to skip in the query\n * results before returning new query results.\n *\n * For example, if you query a collection and 50 items match your query, but\n * you set `skip` to 10, the results returned will skip the first 10 items\n * that match and return the 11th through 50th items.\n *\n * By default, `skip` is set to 0.\n * @public\n * @documentationMaturity preview\n * @param skipCount - Number of items to skip in the query results before returning the results.\n * @requiredField skipCount\n * @returns `WixDataQuery` object representing the refined query.\n */\n skip(skipCount: number): WixDataQuery\n\n /**\n * Includes referenced items for the specified properties in a query's results.\n *\n * The `include()` method refines a query so that the items returned in the\n * query's results include the full referenced items for the specified properties.\n *\n * For example, suppose you have a **books** collection with an **author**\n * field that references an **authors** collection. Querying the **books**\n * collection with an `include(\"author\")` returns the relevant book items\n * and each item will include the full referenced author item in the book's\n * `author` property.\n *\n * When querying a collection that contains a reference field without using the\n * `include()` method:\n * - Single reference field: returned items contain only the ID of the\n * referenced item, and not the full referenced items.\n * - Multiple reference field: returned items do not contain the multiple\n * reference field at all.\n *\n * When including a property with multiple references, the following limitations\n * apply:\n * - Only one property with multiple references can be included.\n * - The query will return an error if more than 50 items are returned, regardless\n * of any query limit set using the `limit()` method.\n * - Each returned item can include up to 50 referenced items. If there are more\n * than 50 referenced items, only 50 are returned when the query is run\n * and the `partialIncludes`\n * property of the returned `WixDataQueryResult`\n * is `true`. To retrieve more than 50 referenced items, use the\n * `queryReferenced()` method.\n *\n * For a discussion of when to use the similar `queryReferenced()`\n * method and when to use `include()`, see [Querying Items that Reference Other Items](https://support.wix.com/en/article/including-referenced-data-when-filtering).\n *\n * > **Note:** The `include()` method is not supported for [single-item collections](https://support.wix.com/en/article/cms-adding-and-setting-up-a-single-item-collection).\n *\n * @public\n * @documentationMaturity preview\n * @param fields - Fields for which to include referenced items.\n * @requiredField fields\n * @returns A `WixDataQuery` object representing the query.\n */\n include(...fields: string[]): WixDataQuery\n\n /**\n * Overload for `include()`\n * @public\n * @documentationMaturity preview\n */\n include(field: string, limit?: number): WixDataQuery\n\n /**\n * Overload for `include()`\n * @public\n * @documentationMaturity preview\n */\n include(field1: string, field2: string, limit?: number): WixDataQuery\n\n /**\n * Overload for `include()`\n * @public\n * @documentationMaturity preview\n */\n include(\n field1: string,\n field2: string,\n field3: string,\n limit?: number\n ): WixDataQuery\n\n /**\n * Overload for `include()`\n * @public\n * @documentationMaturity preview\n */\n include(\n field1: string,\n field2: string,\n field3: string,\n field4: string,\n limit?: number\n ): WixDataQuery\n\n /**\n * Overload for `include()`\n * @public\n * @documentationMaturity preview\n */\n include(\n field1: string,\n field2: string,\n field3: string,\n field4: string,\n field5: string,\n limit?: number\n ): WixDataQuery\n\n /**\n * Overload for `include()`\n * @public\n * @documentationMaturity preview\n */\n include(...fieldNamesAndLimit: [...string[], number]): WixDataQuery\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../../src/api/WixDataSearch.ts"],"sourcesContent":["import { WixDataResult } from './WixDataResult'\nimport { WixDataReadOptions } from './types'\nimport { WixDataFilter } from './WixDataFilter'\n\n/**\n * @builder\n * Represents a search operation to be performed on a Wix Data collection.\n * Allows for building complex search requests by specifying search expressions, modes, filters, sorting, and pagination.\n */\nexport interface WixDataSearch {\n /**\n * Specifies the text to search in the collection.\n *\n * The `expression()` method sets the search query.\n *\n * Search terms are separated by whitespace. For example, the expression `red car white roof` includes four search terms: `red`, `car`, `white`, and `roof`. Use [`andMode()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-search/and-mode) to require all terms to be present, or [`orMode()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-search/or-mode) to require at least one term to be present.\n *\n * @param queryText - Text to search in the collection.\n * @returns Refined WixDataSearch object.\n */\n expression(queryText: string): WixDataSearch\n\n /**\n * Enables fuzzy search for approximate text matching.\n *\n * The `fuzzy()` method enables fuzzy search. This allows for approximate matches that closely resemble the search expression even if they don't exactly match.\n *\n * @returns Refined WixDataSearch object.\n */\n fuzzy(): WixDataSearch\n\n /**\n * Sets the search mode to **AND**.\n *\n * When in **AND** mode, an item must include all specified search terms to be included in the results. For example, the search expression \"red car\" in **AND** mode only retrieves items that include both \"red\" and \"car\".\n *\n * @returns Refined WixDataSearch object.\n */\n andMode(): WixDataSearch\n\n /**\n * Sets the search mode to **OR**.\n *\n * When in **OR** mode, an item must include at least one of the specified search terms to be included in the results. For example, the search expression \"red car\" in **OR** mode retrieves items that include \"red\", \"car\", or both.\n *\n * @returns Refined WixDataSearch object.\n */\n orMode(): WixDataSearch\n\n /**\n * Runs the search operation.\n *\n * The `run()` method searches the collection for the specified expression. It returns a Promise that resolves to a [`WixDataResult`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-result/introduction) that contains the matching items and search metadata.\n *\n * Search operations are [eventually consistent](https://dev.wix.com/docs/sdk/backend-modules/data/eventual-consistency) and might not reflect recent changes.\n * @param options - Options for building the search operation.\n * @returns Promise that resolves to a [`WixDataResult`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-result/introduction) containing the matching items and search metadata.\n */\n run(options?: WixDataReadOptions): Promise<WixDataResult>\n\n /**\n * Sorts search results by the specified fields in descending order.\n *\n * The `descending()` method refines the search to sort results by the specified fields in descending order. If you specify more than one field, `descending()` sorts the results in descending order by each field in the order they are listed.\n *\n * You can sort the following types:\n * - **Number**: Sorts numerically.\n * - **Date**: Sorts by date and time.\n * - **String**: Sorts lexicographically, so `\"abc\"` comes before `\"XYZ\"`.\n * - **Reference**: Compares by the ID of the referenced item as a String.\n *\n * If a field contains a number as a String, that value is sorted alphabetically and not numerically.\n * Items that do not have a value for the specified sort field are ranked lowest.\n *\n * @public\n * @documentationMaturity preview\n * @param fields - Fields by which to sort results in descending order.\n * @requiredField fields\n * @returns Refined WixDataSearch object.\n */\n descending(...fields: string[]): WixDataSearch\n /**\n * @param fields - Array of fields by which to sort results in descending order.\n * @returns Refined WixDataSearch object.\n */\n descending(fields: string[]): WixDataSearch\n /**\n * @param fields - Fields by which to sort results in descending order.\n * @returns Refined WixDataSearch object.\n */\n descending(...fields: any): WixDataSearch\n\n /**\n * Sorts search results in ascending order by the specified fields.\n *\n * The `ascending()` method refines the search to sort results by the specified fields in ascending order. If you specify more than one field, `ascending()` sorts the results in ascending order by each field in the order they are listed.\n *\n * You can sort the following types:\n * - **Number**: Sorts numerically.\n * - **Date**: Sorts by date and time.\n * - **String**: Sorts lexicographically, so `\"abc\"` comes before `\"XYZ\"`.\n * - **Reference**: Compares by the ID of the referenced item as a String.\n *\n * If a field contains a number as a String, that value is sorted alphabetically and not numerically.\n * Items that do not have a value for the specified sort field are ranked lowest.\n *\n * @public\n * @documentationMaturity preview\n * @param fields - Fields by which to sort results in ascending order.\n * @requiredField fields\n * @returns Refined WixDataSearch object.\n */\n ascending(...fields: string[]): WixDataSearch\n /**\n * @param fields - Array of fields by which to sort results in ascending order.\n * @returns Refined WixDataSearch object.\n */\n ascending(fields: string[]): WixDataSearch\n /**\n * @param fields - Fields by which to sort results in ascending order.\n * @returns Refined WixDataSearch object.\n */\n ascending(...fields: any): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value equals the specified value.\n *\n * The `eq()` method refines the search to only match items where the value of the specified field equals the specified `value`. It only matches values of the same type. For example, a number value stored as a String type does not match the same number stored as a Number type.\n *\n * Matching strings with `eq()` is case-sensitive, so `\"text\"` is not considered equal to `\"Text\"`.\n *\n * If the field contains an array, `eq()` matches the item if at least one array element equals the specified `value`.\n *\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns Refined WixDataSearch object.\n */\n eq(field: string, value: any): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value does not equal the specified value.\n *\n * The `ne()` method refines the search to only match items where the value of the specified field does not equal the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored as a String type is considered not equal to the same number stored as a Number type.\n *\n * Matching strings with `ne()` is case-sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If the value of `field` is an array, `ne()` includes items in which none of the elements of the array match the specified `value`.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to not match.\n * @requiredField value\n * @returns Refined WixDataSearch object.\n */\n ne(field: string, value: any): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value is greater than or equal to the specified value.\n *\n * The `ge()` method refines the search to only match items where the value of the specified field is greater than or equal to the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified field are ranked lowest.\n *\n * The following types of fields can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"abc\"` is greater than or equal to `\"ABC\"`, but `\"ABC\"` is not greater than or equal to `\"abc\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to compare against.\n * @requiredField value\n * @returns Refined WixDataSearch object.\n */\n ge(field: string, value: string | number | Date): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value is greater than the specified value.\n *\n * The `gt()` method refines the search to only match items where the value of the specified field is greater than the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared alphabetically and not numerically. Items that do not have a value for the specified field are ranked lowest.\n *\n * The following types of fields can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"text\"` is greater than `\"Text\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to compare against.\n * @requiredField value\n * @returns Refined WixDataSearch object.\n */\n gt(field: string, value: string | number | Date): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value is less than or equal to the specified value.\n *\n * The `le()` method refines the search to only match items where the value of the specified field is less than or equal to the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared alphabetically and not numerically. Items that do not have a value for the specified field are ranked lowest.\n *\n * The following types of fields can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"ABC\"` is less than or equal to `\"abc\"`, but `\"abc\"` is not less than or equal to `\"ABC\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to compare with.\n * @requiredField value\n * @returns Refined WixDataSearch object.\n */\n le(field: string, value: string | number | Date): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value is less than the specified value.\n *\n * The `lt()` method refines the search to only match items where the value of the specified field is less than the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared alphabetically and not numerically. Items that do not have a value for the specified field are ranked lowest.\n *\n * The following types of fields can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"Text\"` is less than `\"text\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to compare with.\n * @requiredField value\n * @returns Refined WixDataSearch object.\n */\n lt(field: string, value: string | number | Date): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field has a value that isn't `null` or `undefined`.\n *\n * The `isNotEmpty()` method refines the search to only match items where the value of the specified field is not `null` or `undefined`.\n *\n * If the field contains any value at all for a given item, including an empty string or an invalid value, that item matches the search filter.\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to check for a non-empty value.\n * @requiredField field\n * @returns Refined WixDataSearch object.\n */\n isNotEmpty(field: string): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field does not exist or does not have any value (is null or undefined).\n *\n * The `isEmpty()` method refines the search to only match items where the specified field does not exist or where its value is `null` or `undefined`.\n *\n * If the field contains any value at all for a given item, including an empty string or an invalid value, that item does not match the search filter.\n * @public\n * @documentationMaturity preview\n * @param field - Field in which to check for an empty or non-existent value.\n * @requiredField field\n * @returns Refined WixDataSearch object.\n */\n isEmpty(field: string): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value starts with a specified string.\n *\n * The `startsWith()` method refines the search to only match items where the value of the specified field starts with the specified `string`. Matching with `startsWith()` is case-sensitive, so searching for `\"Sun\"` does not match an item that contains the text `\"sunshine\"`.\n *\n * You can only use `startsWith()` with a field whose value is a String or Reference. When using a Reference, `startsWith()` matches by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the `value` parameter.\n * @requiredField field\n * @param value - String to look for at the beginning of the specified field value.\n * @requiredField value\n * @returns Refined WixDataSearch object.\n */\n startsWith(field: string, value: string): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value equals any of the specified values.\n *\n * The `hasSome()` method refines the search to only match items where the value of the specified field equals any of the specified values.\n *\n * Matching strings with `hasSome()` is case-sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If the specified field contains an array, `hasSome()` matches if any of the elements in that array match any of the specified values.\n *\n * If the specified field contains multiple references, pass item IDs as the values. `hasSome()` matches if any of the multiple references match any of the specified ID values.\n *\n * You can specify multiple values to match by providing an array of String, Number, or Date types as the `values` parameters.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `values`.\n * @requiredField field\n * @param values - Values to match.\n * @requiredField values\n * @returns Refined WixDataSearch object.\n */\n hasSome(field: string, ...values: string[] | number[] | Date[]): WixDataSearch\n\n /**\n * Overload for `hasSome()`. Refines a search to match items whose specified field value equals any of the specified values.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the provided values.\n * @requiredField field\n * @param values - An array of values to match.\n * @requiredField values\n * @returns Refined WixDataSearch object.\n */\n hasSome(field: string, values: string[] | number[] | Date[]): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value equals all of the specified values.\n *\n * The `hasAll()` method refines the search to only match items where the value of the specified field equals all of the specified values.\n *\n * Matching strings with `hasAll()` is case-sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If the value of the specified field is an array, `hasAll()` matches if there is a match in the elements of that array for all of the specified values.\n *\n * You can specify a list of values to match by providing an array of String, Number, or Date types as the `values` parameters.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `values`.\n * @requiredField field\n * @param values - Values to match. All specified values must be present.\n * @requiredField values\n * @returns Refined WixDataSearch object.\n */\n hasAll(field: string, ...values: string[] | number[] | Date[]): WixDataSearch\n\n /**\n * Overload for `hasAll()`. Refines a search to match items whose specified field values equals all of the specified values.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the provided values.\n * @requiredField field\n * @param values - Array of values to match. All elements in the array must be present.\n * @requiredField values\n * @returns Refined WixDataSearch object.\n */\n hasAll(field: string, values: string[] | number[] | Date[]): WixDataSearch\n\n /**\n * Adds an `or` condition to the search filter.\n *\n * The `or()` method adds an inclusive `or` condition to the search filter. The search returns all the items that match the filter as defined up to the `or()` method, the items that match the filter passed to the `or()` method, and the items that match both.\n *\n * > **Note**: Calling `or()` without a filter may lead to unexpected results.\n *\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial filter as an `or` condition.\n * @requiredField filter\n * @returns Refined WixDataSearch object.\n */\n or(filter: WixDataFilter): WixDataSearch\n\n /**\n * Adds an `and` condition to the search filter.\n *\n * The `and()` method adds an `and` condition to the search filter. A search with an `and` returns all the items that match both the filter as defined up to the `and()` method, and the filter passed to the `and()` method.\n *\n * When chaining multiple filter methods to a search, an `and` condition is often assumed by default. For example, the search returns results whose status is active **and** age is greater than 25:\n *\n * ```javascript\n * items\n * .search(\"myCollection\")\n * .expression(\"some text\")\n * .eq(\"status\", \"active\")\n * .gt(\"age\", 25);\n * ```\n *\n * The `and()` method is needed when using compound filters. For example, the final search in this set of operations returns results whose status is either pending or rejected **and** age is either less than 25 or greater than 65:\n *\n * ```javascript\n * let statusFilter = items\n * .filter()\n * .eq(\"status\", \"pending\")\n * .or(items.filter().eq(\"status\", \"rejected\"));\n *\n * let ageFilter = items\n * .filter()\n * .lt(\"age\", 25)\n * .or(items.filter().gt(\"age\", 65));\n *\n * let finalSearch = items\n * .search(\"myCollection\")\n * .expression(\"some text\")\n * .and(statusFilter)\n * .and(ageFilter);\n * ```\n *\n * > **Note**: Calling `and()` without a filter may lead to unexpected results.\n *\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial search filter as an `and` condition.\n * @requiredField filter\n * @returns Refined WixDataSearch object.\n */\n and(filter: WixDataFilter): WixDataSearch\n\n /**\n * Adds a `not` condition to the search filter.\n *\n * The `not()` method adds a `not` condition to the search filter. A search with a `not` returns all the items that match the filter as defined up to the `not()` method and don't match the filter passed to the `not()` method.\n *\n * If the search filter only contains a `not()` method, it returns all the items that don't match the filter specified to the method.\n *\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial filter as a `not` condition.\n * @requiredField filter\n * @returns Refined WixDataSearch object.\n */\n not(filter: WixDataFilter): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field value is within a specified range.\n *\n * The `between()` method refines the search to only match items where the value of the specified field is greater than or equal to `rangeStart` and less than `rangeEnd`.\n *\n * It only matches values of the same type. For example, a number value stored as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared alphabetically and not numerically. Items that do not have a value for the specified field are ranked lowest.\n *\n * The following types of fields can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so\n * - `\"A\"` and `\"M\"` are between `\"A\"` and `\"Z\"`, but `\"a\"`, `\"m\"`, `\"z\"` and `\"Z\"` are not.\n * - `\"A\"`, `\"M\"`, `\"Z\"`, and `\"a\"` are between `\"A\"` and `\"z\"`, but `\"z\"` is not.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `rangeStart` and `rangeEnd`.\n * @requiredField field\n * @param rangeStart - Starting value of the range to match (inclusive).\n * @requiredField rangeStart\n * @param rangeEnd - Ending value of the range to match (exclusive).\n * @requiredField rangeEnd\n * @returns Refined WixDataSearch object.\n */\n between(\n field: string,\n rangeStart: string | number | Date,\n rangeEnd: string | number | Date\n ): WixDataSearch\n\n /**\n * Lists the fields to return in the search results.\n *\n * The `fields()` method specifies which fields to return in the search results.\n *\n * You can use `include()` together with `fields()` to get referenced items.\n *\n * When `fields()` receives an empty or an invalid field, the search behaves as follows:\n * - When no fields are specified, the search returns all fields.\n * - When multiple fields are specified but some are invalid, invalid fields are ignored and valid fields are returned.\n * - When only invalid fields are specified, only the default `_id` field is returned.\n * @public\n * @documentationMaturity preview\n * @param fields - Fields to return.\n * @requiredField fields\n * @returns Refined WixDataSearch object.\n */\n fields(...fields: string[]): WixDataSearch\n\n /**\n * Limits the number of items the search returns.\n *\n * The `limit()` method defines the number of results a search operation returns in each page. Only one page of results is retrieved at a time. The `next()` and `prev()` methods of the [`WixDataResult`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-result/introduction) object are used to navigate the pages of a search result.\n *\n * By default, `limit` is set to `100`.\n *\n * The maximum value that `limit()` can accept is `1000`.\n *\n * @public\n * @documentationMaturity preview\n * @param limitNumber - Number of items to return, which is also the `pageSize` of the results object.\n * @requiredField limitNumber\n * @returns Refined WixDataSearch object.\n */\n limit(limitNumber: number): WixDataSearch\n\n /**\n * Sets the number of items to skip before returning search results.\n *\n * The `skip()` method defines the number of results to skip in the search results before returning new search results.\n *\n * For example, if your search matches 50 items, but you set `skip` to 10, the results returned skips the first 10 items that match and return the 11th through 50th items.\n *\n * By default, `skip()` is set to 0.\n * @public\n * @documentationMaturity preview\n * @param skipCount - Number of items to skip before returning the results.\n * @requiredField skipCount\n * @returns Refined WixDataSearch object.\n */\n skip(skipCount: number): WixDataSearch\n\n /**\n * Includes referenced items for the specified fields.\n *\n * The `include()` method refines a search so that the items returned in the search results include the full referenced items for the specified fields.\n *\n * For example, suppose you have a **books** collection with an **author** field that references an **authors** collection. Searching the **books** collection with an `include(\"author\")` returns the relevant book items, and each item includes the full referenced author item in the book's `author` field.\n *\n * When searching a collection that contains a reference field without using the `include()` method:\n * - Single reference field: returned items contain only the ID of the referenced item, and not the full referenced items.\n * - Multiple reference field: returned items do not contain the multiple reference field at all.\n *\n * When including a field with multiple references, the following limitations apply:\n * - Only one field with multiple references can be included.\n * - The search returns an error if more than 50 items are returned, regardless of any search limit set using the `limit()` method.\n * - Each returned item can include up to 50 referenced items. If there are more than 50 referenced items, only 50 are returned, and the `partialIncludes` field of the returned `WixDataResult` is `true`.\n *\n * > **Note:** The `include()` method is not supported for [single-item collections](https://support.wix.com/en/article/cms-adding-and-setting-up-a-single-item-collection).\n *\n * @public\n * @documentationMaturity preview\n * @param fields - Fields for which to include referenced items.\n * @requiredField fields\n * @returns Refined WixDataSearch object.\n */\n include(...fields: string[]): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified field in a search's results.\n * @public\n * @documentationMaturity preview\n * @param field - Field for which to include referenced items.\n * @param limit - Optional limit for the number of referenced items to include (behavior may vary).\n * @returns Refined WixDataSearch object.\n */\n include(field: string, limit?: number): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified fields in a search's results.\n * @public\n * @documentationMaturity preview\n * @param field1 - First field for which to include referenced items.\n * @param field2 - Second field for which to include referenced items.\n * @param limit - Optional limit for the number of referenced items to include (behavior may vary).\n * @returns Refined WixDataSearch object.\n */\n include(field1: string, field2: string, limit?: number): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified fields in a search's results.\n * @public\n * @documentationMaturity preview\n * @param field1 - First field.\n * @param field2 - Second field.\n * @param field3 - Third field.\n * @param limit - Optional limit.\n * @returns Refined WixDataSearch object.\n */\n include(\n field1: string,\n field2: string,\n field3: string,\n limit?: number\n ): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified fields in a search's results.\n * @public\n * @documentationMaturity preview\n * @param field1 - First field.\n * @param field2 - Second field.\n * @param field3 - Third field.\n * @param field4 - Fourth field.\n * @param limit - Optional limit.\n * @returns Refined WixDataSearch object.\n */\n include(\n field1: string,\n field2: string,\n field3: string,\n field4: string,\n limit?: number\n ): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified fields in a search's results.\n * @public\n * @documentationMaturity preview\n * @param field1 - First field.\n * @param field2 - Second field.\n * @param field3 - Third field.\n * @param field4 - Fourth field.\n * @param field5 - Fifth field.\n * @param limit - Optional limit.\n * @returns Refined WixDataSearch object.\n */\n include(\n field1: string,\n field2: string,\n field3: string,\n field4: string,\n field5: string,\n limit?: number\n ): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified fields in a search's results.\n * Allows specifying multiple field names and an optional limit.\n * @public\n * @documentationMaturity preview\n * @param fieldNamesAndLimit - Array of field names, optionally followed by a limit number.\n * @returns Refined WixDataSearch object.\n */\n include(...fieldNamesAndLimit: [...string[], number]): WixDataSearch\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/api/WixDataSearch.ts"],"sourcesContent":["import { WixDataResult } from './WixDataResult'\nimport { WixDataReadOptions } from './types'\nimport { WixDataFilter } from './WixDataFilter'\n\n/**\n * @builder\n * Represents a search operation to be performed on a Wix Data collection.\n * Allows for building complex search requests by specifying search expressions, modes, filters, sorting, and pagination.\n */\nexport interface WixDataSearch {\n /**\n * Specifies the text to search in the collection.\n *\n * The `expression()` method sets the search query.\n *\n * Search terms are separated by whitespace. For example, the expression `red car white roof` includes four search terms: `red`, `car`, `white`, and `roof`. Use [`andMode()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-search/and-mode) to require all terms to be present, or [`orMode()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-search/or-mode) to require at least one term to be present.\n *\n * @param queryText - Text to search in the collection.\n * @returns Refined WixDataSearch object.\n */\n expression(queryText: string): WixDataSearch\n\n /**\n * Enables fuzzy search for approximate text matching.\n *\n * The `fuzzy()` method enables fuzzy search. This allows for approximate matches that closely resemble the search expression even if they don't exactly match.\n *\n * @returns Refined WixDataSearch object.\n */\n fuzzy(): WixDataSearch\n\n /**\n * Sets the search mode to **AND**.\n *\n * When in **AND** mode, an item must include all specified search terms to be included in the results. For example, the search expression \"red car\" in **AND** mode only retrieves items that include both \"red\" and \"car\".\n *\n * @returns Refined WixDataSearch object.\n */\n andMode(): WixDataSearch\n\n /**\n * Sets the search mode to **OR**.\n *\n * When in **OR** mode, an item must include at least one of the specified search terms to be included in the results. For example, the search expression \"red car\" in **OR** mode retrieves items that include \"red\", \"car\", or both.\n *\n * @returns Refined WixDataSearch object.\n */\n orMode(): WixDataSearch\n\n /**\n * Runs the search operation.\n *\n * The `run()` method searches the collection for the specified expression. It returns a Promise that resolves to a [`WixDataResult`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-result/introduction) that contains the matching items and search metadata.\n *\n * Search operations are [eventually consistent](https://dev.wix.com/docs/sdk/backend-modules/data/eventual-consistency) and might not reflect recent changes.\n * @param options - Options for building the search operation.\n * @returns Promise that resolves to a [`WixDataResult`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-result/introduction) containing the matching items and search metadata.\n */\n run(options?: WixDataReadOptions): Promise<WixDataResult>\n\n /**\n * Sorts search results by the specified fields in descending order.\n *\n * The `descending()` method refines the search to sort results by the specified fields in descending order. If you specify more than one field, `descending()` sorts the results in descending order by each field in the order they are listed.\n *\n * You can sort the following types:\n * - **Number**: Sorts numerically.\n * - **Date**: Sorts by date and time.\n * - **String**: Sorts lexicographically, so `\"abc\"` comes before `\"XYZ\"`.\n * - **Reference**: Compares by the ID of the referenced item as a String.\n *\n * If a field contains a number as a String, that value is sorted alphabetically and not numerically.\n * Items that do not have a value for the specified sort field are ranked lowest.\n *\n * @public\n * @documentationMaturity preview\n * @param fields - Fields by which to sort results in descending order.\n * @requiredField fields\n * @returns Refined WixDataSearch object.\n */\n descending(...fields: string[]): WixDataSearch\n /**\n * @param fields - Array of fields by which to sort results in descending order.\n * @returns Refined WixDataSearch object.\n */\n descending(fields: string[]): WixDataSearch\n /**\n * @param fields - Fields by which to sort results in descending order.\n * @returns Refined WixDataSearch object.\n */\n descending(...fields: any): WixDataSearch\n\n /**\n * Sorts search results in ascending order by the specified fields.\n *\n * The `ascending()` method refines the search to sort results by the specified fields in ascending order. If you specify more than one field, `ascending()` sorts the results in ascending order by each field in the order they are listed.\n *\n * You can sort the following types:\n * - **Number**: Sorts numerically.\n * - **Date**: Sorts by date and time.\n * - **String**: Sorts lexicographically, so `\"abc\"` comes before `\"XYZ\"`.\n * - **Reference**: Compares by the ID of the referenced item as a String.\n *\n * If a field contains a number as a String, that value is sorted alphabetically and not numerically.\n * Items that do not have a value for the specified sort field are ranked lowest.\n *\n * @public\n * @documentationMaturity preview\n * @param fields - Fields by which to sort results in ascending order.\n * @requiredField fields\n * @returns Refined WixDataSearch object.\n */\n ascending(...fields: string[]): WixDataSearch\n /**\n * @param fields - Array of fields by which to sort results in ascending order.\n * @returns Refined WixDataSearch object.\n */\n ascending(fields: string[]): WixDataSearch\n /**\n * @param fields - Fields by which to sort results in ascending order.\n * @returns Refined WixDataSearch object.\n */\n ascending(...fields: any): WixDataSearch\n\n /**\n * Refines a search to match items where the value of the specified field equals the specified value.\n *\n * The `eq()` method refines the search to only match items where the value of the specified field equals the specified `value`. The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data). For example, a number value stored as a number does not match the same number stored as a string.\n *\n * Matching strings with `eq()` is case-sensitive, so `\"text\"` is not considered equal to `\"Text\"`.\n *\n * If the field contains an array, `eq()` matches the item if at least one array element equals the specified `value`.\n *\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns Refined WixDataSearch object.\n */\n eq(field: string, value: any): WixDataSearch\n\n /**\n * Refines a search to match items where the value of the specified field does not equal the specified value.\n *\n * The `ne()` method refines the search to only match items where the value of the specified field does not equal the specified `value`.\n *\n * The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data). For example, a number value stored as a number is considered not equal to the same number stored as a string.\n *\n * Matching strings with `ne()` is case-sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If the value of `field` is an array, `ne()` includes items in which none of the elements of the array match the specified `value`.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to not match.\n * @requiredField value\n * @returns Refined WixDataSearch object.\n */\n ne(field: string, value: any): WixDataSearch\n\n /**\n * Refines a search to match items where the value of the specified field is greater than or equal to the specified value.\n *\n * The `ge()` method refines the search to only match items where the value of the specified field is greater than or equal to the specified `value`.\n *\n * The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data). For example, a number value stored\n * as a number does not match the same number stored as a string.\n *\n * If a field contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified field are ranked lowest.\n *\n * The following types of fields can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"abc\"` is greater than or equal to `\"ABC\"`, but `\"ABC\"` is not greater than or equal to `\"abc\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to compare against.\n * @requiredField value\n * @returns Refined WixDataSearch object.\n */\n ge(field: string, value: string | number | Date): WixDataSearch\n\n /**\n * Refines a search to match items where the value of the specified field is greater than the specified value.\n *\n * The `gt()` method refines the search to only match items where the value of the specified field is greater than the specified `value`.\n *\n * The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data). For example, a number value stored as a number does not match the same number stored as a string.\n *\n * If a field contains a number as a String, that value is compared alphabetically and not numerically. Items that do not have a value for the specified field are ranked lowest.\n *\n * The following types of fields can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"text\"` is greater than `\"Text\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to compare against.\n * @requiredField value\n * @returns Refined WixDataSearch object.\n */\n gt(field: string, value: string | number | Date): WixDataSearch\n\n /**\n * Refines a search to match items where the value of the specified field is less than or equal to the specified value.\n *\n * The `le()` method refines the search to only match items where the value of the specified field is less than or equal to the specified value.\n *\n * The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data). For example, a number value stored as a number does not match the same number stored as a string.\n *\n * If a field contains a number as a String, that value is compared alphabetically and not numerically. Items that do not have a value for the specified field are ranked lowest.\n *\n * The following types of fields can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"ABC\"` is less than or equal to `\"abc\"`, but `\"abc\"` is not less than or equal to `\"ABC\"`.\n * - Reference: Compares by the ID of the referenced item as a string.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to compare with.\n * @requiredField value\n * @returns Refined WixDataSearch object.\n */\n le(field: string, value: string | number | Date): WixDataSearch\n\n /**\n * Refines a search to match items where the value of the specified field is less than the specified value.\n *\n * The `lt()` method refines the search to only match items where the value of the specified field is less than the specified `value`.\n *\n * The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data). For example, a number value stored as a number does not match the same number stored as a string.\n *\n * If a field contains a number as a string, that value is compared alphabetically and not numerically. Items that do not have a value for the specified field are ranked lowest.\n *\n * The following types of fields can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"Text\"` is less than `\"text\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to compare with.\n * @requiredField value\n * @returns Refined WixDataSearch object.\n */\n lt(field: string, value: string | number | Date): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field has a value that isn't `null` or `undefined`.\n *\n * The `isNotEmpty()` method refines the search to only match items where the value of the specified field is not `null` or `undefined`.\n *\n * If the field contains any value at all for a given item, including an empty string or an invalid value, that item matches the search filter.\n * @public\n * @documentationMaturity preview\n * @param field - Field to check for a non-empty value.\n * @requiredField field\n * @returns Refined WixDataSearch object.\n */\n isNotEmpty(field: string): WixDataSearch\n\n /**\n * Refines a search to match items whose specified field does not exist or does not have any value (is null or undefined).\n *\n * The `isEmpty()` method refines the search to only match items where the specified field does not exist or where its value is `null` or `undefined`.\n *\n * If the field contains any value at all for a given item, including an empty string or an invalid value, that item does not match the search filter.\n * @public\n * @documentationMaturity preview\n * @param field - Field to check for an empty or non-existent value.\n * @requiredField field\n * @returns Refined WixDataSearch object.\n */\n isEmpty(field: string): WixDataSearch\n\n /**\n * Refines a search to match items where the value of the specified field starts with a specified value.\n *\n * The `startsWith()` method refines the search to only match items where the value of the specified field starts with the specified value. Matching with `startsWith()` is case-sensitive, so searching for `\"Sun\"` does not match an item that contains the text `\"sunshine\"`.\n *\n * You can only use `startsWith()` with a field whose value is a String or Reference. When using a Reference, `startsWith()` matches by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the `value` parameter.\n * @requiredField field\n * @param value - String to look for at the beginning of the specified field value.\n * @requiredField value\n * @returns Refined WixDataSearch object.\n */\n startsWith(field: string, value: string): WixDataSearch\n\n /**\n * Refines a search to match items where the value of the specified field equals any of the specified values.\n *\n * The `hasSome()` method refines the search to only match items where the value of the specified field equals any of the specified values.\n *\n * Matching strings with `hasSome()` is case-sensitive, so `\"text\"` is not considered equal to `\"Text\"`.\n *\n * If the specified field contains an array, `hasSome()` matches items where any of the array's elements match any of the specified values.\n *\n * If the specified field contains multiple references, pass item IDs as the values. `hasSome()` matches if any of the references match any of the specified ID values.\n *\n * You can specify multiple values to match by providing an array of strings, numbers, or dates.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the specified values.\n * @requiredField field\n * @param values - Values to match.\n * @requiredField values\n * @returns Refined WixDataSearch object.\n */\n hasSome(field: string, ...values: string[] | number[] | Date[]): WixDataSearch\n\n /**\n * Overload for `hasSome()`. Refines a search to match items where the value of the specified field equals any of the specified values.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the provided values.\n * @requiredField field\n * @param values - Array of values to match.\n * @requiredField values\n * @returns Refined WixDataSearch object.\n */\n hasSome(field: string, values: string[] | number[] | Date[]): WixDataSearch\n\n /**\n * Refines a search to match items where the value of the specified field equals all of the specified values.\n *\n * The `hasAll()` method refines the search to only match items where the value of the specified field equals all of the specified values.\n *\n * Matching strings with `hasAll()` is case-sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If the value of the specified field is an array, `hasAll()` matches if there is a match in the elements of that array for all of the specified values.\n *\n * You can specify a list of values to match by providing an array of String, Number, or Date types as the `values` parameters.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `values`.\n * @requiredField field\n * @param values - Values to match. All specified values must be present.\n * @requiredField values\n * @returns Refined WixDataSearch object.\n */\n hasAll(field: string, ...values: string[] | number[] | Date[]): WixDataSearch\n\n /**\n * Overload for `hasAll()`. Refines a search to match items where the value of the specified fields equals all of the specified values.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with the provided values.\n * @requiredField field\n * @param values - Array of values to match. All elements in the array must be present.\n * @requiredField values\n * @returns Refined WixDataSearch object.\n */\n hasAll(field: string, values: string[] | number[] | Date[]): WixDataSearch\n\n /**\n * Adds an `or` condition to the search filter.\n *\n * The `or()` method adds an inclusive `or` condition to the search filter. The search returns all the items that match the filter as defined up to the `or()` method, the items that match the filter passed to the `or()` method, and the items that match both.\n *\n * > **Note**: Calling `or()` without a filter may lead to unexpected results.\n *\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial filter as an `or` condition.\n * @requiredField filter\n * @returns Refined WixDataSearch object.\n */\n or(filter: WixDataFilter): WixDataSearch\n\n /**\n * Adds an `and` condition to the search filter.\n *\n * The `and()` method adds an `and` condition to the search filter. A search with an `and` returns all the items that match both the filter as defined up to the `and()` method, and the filter passed to the `and()` method.\n *\n * When chaining multiple filter methods to a search, an `and` condition is often assumed by default. For example, the search returns results whose status is active **and** age is greater than 25:\n *\n * ```javascript\n * items\n * .search(\"myCollection\")\n * .expression(\"some text\")\n * .eq(\"status\", \"active\")\n * .gt(\"age\", 25);\n * ```\n *\n * The `and()` method is needed when using compound filters. For example, the final search in this set of operations returns results whose status is either pending or rejected **and** age is either less than 25 or greater than 65:\n *\n * ```javascript\n * let statusFilter = items\n * .filter()\n * .eq(\"status\", \"pending\")\n * .or(items.filter().eq(\"status\", \"rejected\"));\n *\n * let ageFilter = items\n * .filter()\n * .lt(\"age\", 25)\n * .or(items.filter().gt(\"age\", 65));\n *\n * let finalSearch = items\n * .search(\"myCollection\")\n * .expression(\"some text\")\n * .and(statusFilter)\n * .and(ageFilter);\n * ```\n *\n * > **Note**: Calling `and()` without a filter may lead to unexpected results.\n *\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial search filter as an `and` condition.\n * @requiredField filter\n * @returns Refined WixDataSearch object.\n */\n and(filter: WixDataFilter): WixDataSearch\n\n /**\n * Adds a `not` condition to the search filter.\n *\n * The `not()` method adds a `not` condition to the search filter. A search with a `not` returns all the items that match the filter as defined up to the `not()` method and don't match the filter passed to the `not()` method.\n *\n * If the search filter only contains a `not()` method, it returns all the items that don't match the filter specified to the method.\n *\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial filter as a `not` condition.\n * @requiredField filter\n * @returns Refined WixDataSearch object.\n */\n not(filter: WixDataFilter): WixDataSearch\n\n /**\n * Refines a search to match items where the value of the specified field is within a specified range.\n *\n * The `between()` method refines the search to only match items where the value of the specified field is greater than or equal to `rangeStart` and less than `rangeEnd`.\n *\n * The method only matches values of the same [data type](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-types-in-wix-data). For example, a number value stored as a number does not match the same number stored as a string.\n *\n * If a field contains a number as a string, that value is compared alphabetically and not numerically. Items that do not have a value for the specified field are ranked lowest.\n *\n * The following types of fields can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so\n * - `\"A\"` and `\"M\"` are between `\"A\"` and `\"Z\"`, but `\"a\"`, `\"m\"`, `\"z\"` and `\"Z\"` are not.\n * - `\"A\"`, `\"M\"`, `\"Z\"`, and `\"a\"` are between `\"A\"` and `\"z\"`, but `\"z\"` is not.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `rangeStart` and `rangeEnd`.\n * @requiredField field\n * @param rangeStart - Starting value of the range to match (inclusive).\n * @requiredField rangeStart\n * @param rangeEnd - Ending value of the range to match (exclusive).\n * @requiredField rangeEnd\n * @returns Refined WixDataSearch object.\n */\n between(\n field: string,\n rangeStart: string | number | Date,\n rangeEnd: string | number | Date\n ): WixDataSearch\n\n /**\n * Lists the fields to return in the search results.\n *\n * The `fields()` method specifies which fields to return in the search results.\n *\n * You can use `include()` together with `fields()` to get referenced items.\n *\n * When `fields()` receives an empty or an invalid field, the search behaves as follows:\n * - When no fields are specified, the search returns all fields.\n * - When multiple fields are specified but some are invalid, invalid fields are ignored and valid fields are returned.\n * - When only invalid fields are specified, only the default `_id` field is returned.\n * @public\n * @documentationMaturity preview\n * @param fields - Fields to return.\n * @requiredField fields\n * @returns Refined WixDataSearch object.\n */\n fields(...fields: string[]): WixDataSearch\n\n /**\n * Limits the number of items the search returns.\n *\n * The `limit()` method defines the number of results a search operation returns in each page. Only one page of results is retrieved at a time. The `next()` and `prev()` methods of the [`WixDataResult`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-result/introduction) object are used to navigate the pages of a search result.\n *\n * By default, `limit` is set to `100`.\n *\n * The maximum value that `limit()` can accept is `1000`.\n *\n * @public\n * @documentationMaturity preview\n * @param limitNumber - Number of items to return, which is also the `pageSize` of the results object.\n * @requiredField limitNumber\n * @returns Refined WixDataSearch object.\n */\n limit(limitNumber: number): WixDataSearch\n\n /**\n * Sets the number of items to skip before returning search results.\n *\n * The `skip()` method defines the number of results to skip in the search results before returning new search results.\n *\n * For example, if your search matches 50 items, but you set `skip` to 10, the results returned skips the first 10 items that match and return the 11th through 50th items.\n *\n * By default, `skip()` is set to 0.\n * @public\n * @documentationMaturity preview\n * @param skipCount - Number of items to skip before returning the results.\n * @requiredField skipCount\n * @returns Refined WixDataSearch object.\n */\n skip(skipCount: number): WixDataSearch\n\n /**\n * Includes referenced items for the specified fields.\n *\n * The `include()` method refines a search so that the items returned in the search results include the full referenced items for the specified fields.\n *\n * For example, suppose you have a **books** collection with an **author** field that references an **authors** collection. Searching the **books** collection with an `include(\"author\")` returns the relevant book items, and each item includes the full referenced author item in the book's `author` field.\n *\n * When searching a collection that contains a reference field without using the `include()` method:\n * - Single reference field: returned items contain only the ID of the referenced item, and not the full referenced items.\n * - Multiple reference field: returned items do not contain the multiple reference field at all.\n *\n * When including a field with multiple references, the following limitations apply:\n * - Only one field with multiple references can be included.\n * - The search returns an error if more than 50 items are returned, regardless of any search limit set using the `limit()` method.\n * - Each returned item can include up to 50 referenced items. If there are more than 50 referenced items, only 50 are returned, and the `partialIncludes` field of the returned `WixDataResult` is `true`.\n *\n * > **Note:** The `include()` method is not supported for [single-item collections](https://support.wix.com/en/article/cms-adding-and-setting-up-a-single-item-collection).\n *\n * @public\n * @documentationMaturity preview\n * @param fields - Fields for which to include referenced items.\n * @requiredField fields\n * @returns Refined WixDataSearch object.\n */\n include(...fields: string[]): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified field in a search's results.\n * @public\n * @documentationMaturity preview\n * @param field - Field for which to include referenced items.\n * @param limit - Optional limit for the number of referenced items to include (behavior may vary).\n * @returns Refined WixDataSearch object.\n */\n include(field: string, limit?: number): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified fields in a search's results.\n * @public\n * @documentationMaturity preview\n * @param field1 - First field for which to include referenced items.\n * @param field2 - Second field for which to include referenced items.\n * @param limit - Optional limit for the number of referenced items to include (behavior may vary).\n * @returns Refined WixDataSearch object.\n */\n include(field1: string, field2: string, limit?: number): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified fields in a search's results.\n * @public\n * @documentationMaturity preview\n * @param field1 - First field.\n * @param field2 - Second field.\n * @param field3 - Third field.\n * @param limit - Optional limit.\n * @returns Refined WixDataSearch object.\n */\n include(\n field1: string,\n field2: string,\n field3: string,\n limit?: number\n ): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified fields in a search's results.\n * @public\n * @documentationMaturity preview\n * @param field1 - First field.\n * @param field2 - Second field.\n * @param field3 - Third field.\n * @param field4 - Fourth field.\n * @param limit - Optional limit.\n * @returns Refined WixDataSearch object.\n */\n include(\n field1: string,\n field2: string,\n field3: string,\n field4: string,\n limit?: number\n ): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified fields in a search's results.\n * @public\n * @documentationMaturity preview\n * @param field1 - First field.\n * @param field2 - Second field.\n * @param field3 - Third field.\n * @param field4 - Fourth field.\n * @param field5 - Fifth field.\n * @param limit - Optional limit.\n * @returns Refined WixDataSearch object.\n */\n include(\n field1: string,\n field2: string,\n field3: string,\n field4: string,\n field5: string,\n limit?: number\n ): WixDataSearch\n\n /**\n * Overload for `include()`. Includes referenced items for the specified fields in a search's results.\n * Allows specifying multiple field names and an optional limit.\n * @public\n * @documentationMaturity preview\n * @param fieldNamesAndLimit - Array of field names, optionally followed by a limit number.\n * @returns Refined WixDataSearch object.\n */\n include(...fieldNamesAndLimit: [...string[], number]): WixDataSearch\n}\n"],"mappings":"","ignoreList":[]}
|