@wix/wix-data-items-common 1.0.63 → 1.0.64

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.
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../../src/api/WixDataAggregate.ts"],"sourcesContent":["import { WixDataFilter } from './WixDataFilter'\nimport { WixDataReadOptions } 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()` function refines a `WixDataAggregate` to contain the sum of the\n * values from the specified property 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 `projectedName`, the key is named\n * using that value. Otherwise, the key is named using the following format:\n * `\"propertyNameSum\"`, where `propertyName` is the name of the specified property.\n * - The value is the sum of the values found in the specified property.\n *\n * Sums can only be calculated on properties 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://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).\n * @public\n * @documentationMaturity preview\n * @param fieldName - The property in which to find the sum.\n * @requiredField fieldName\n * @param projectedField - The name of the property in the aggregation results containing the sum.\n * @returns A `WixDataAggregate` object representing the refined aggregation.\n */\n sum(fieldName: string, projectedField?: string): WixDataAggregate\n\n /**\n * Refines a `WixDataAggregate` to only contain the average value from each aggregation group.\n *\n * The `avg()` function refines a `WixDataAggregate` to contain the average\n * value from the specified property 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 `projectedName`, the key is named\n * using that value. Otherwise, the key is named using the following format:\n * `\"propertyNameAvg\"`, where `propertyName` is the name of the specified property.\n * - The value is the average of the values found in the specified property.\n *\n * Averages can only be calculated on properties 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://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).\n * @public\n * @documentationMaturity preview\n * @param fieldName - The property in which to find the average value.\n * @requiredField fieldName\n * @param projectedField - The name of the property in the aggregation results containing the average value.\n * @returns A `WixDataAggregate` object representing the refined aggregation.\n */\n avg(fieldName: string, projectedField?: string): WixDataAggregate\n\n /**\n * Refines a `WixDataAggregate` to only contain the minimum value from each aggregation group.\n *\n * The `min()` function refines a `WixDataAggregate` to contain the minimum\n * value from the specified property 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 `projectedName`, the key is named\n * using that value. Otherwise, the key is named using the following format:\n * `\"propertyNameMin\"`, where `propertyName` is the name of the specified property.\n * - The value is the minimum value found in the specified property.\n *\n * The following types of properties 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://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).\n * @public\n * @documentationMaturity preview\n * @param fieldName - The property in which to find the minimum value.\n * @requiredField fieldName\n * @param projectedField - The name of the property in the aggregation results containing the minimum value.\n * @returns A `WixDataAggregate` object representing the refined aggregation.\n */\n min(fieldName: string, projectedField?: string): WixDataAggregate\n\n /**\n * Refines a `WixDataAggregate` to only contain the maximum value from each aggregation group.\n *\n * The `max()` function refines a `WixDataAggregate` to contain the maximum\n * value from the specified property 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 `projectedName`, the key is named\n * using that value. Otherwise, the key is named using the following format:\n * `\"propertyNameMax\"`, where `propertyName` is the name of the specified property.\n * - The value is the maximum value found in the specified property.\n *\n * The following types of properties 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://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).\n * @public\n * @documentationMaturity preview\n * @param fieldName - The property in which to find the maximum value.\n * @requiredField fieldName\n * @param projectedField - The name of the property in the aggregation results containing the maximum value.\n * @returns A `WixDataAggregate` object representing the refined aggregation.\n */\n max(fieldName: 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()` function refines a `WixDataAggregate` to contain the item\n * 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\"`.\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://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).\n * @public\n * @documentationMaturity preview\n * @param projectedField - The name of the property in the aggregation results containing the count value.\n * @returns A `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()` function 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()` function.\n *\n * Filtering using `filter()` takes place before grouping is performed on the\n * aggregation. To filter grouped results, use the `having()` function.\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 filterBuilder - The filter to use to filter out items from being used in the aggregation.\n * @requiredField filterBuilder\n * @returns A `WixDataAggregate` object representing the refined aggregation.\n */\n filter(filterBuilder: WixDataFilter): WixDataAggregate\n\n /**\n * Groups items together in an aggregation.\n *\n * The `group()` function refines a `WixDataAggregate` so that its items are\n * grouped by the specified property or properties.\n *\n * You can perform aggregations on the groups using the following functions:\n * - `avg()`\n * - `count()`\n * - `max()`\n * - `min()`\n * - `sum()`\n *\n * To filter grouped results, use the `having()` function.\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()` function once per aggregate query.\n * @public\n * @documentationMaturity preview\n * @param fieldName - The property or properties to group on.\n * @requiredField fieldName\n * @returns A `WixDataAggregate` object representing the refined aggregation.\n */\n group(...fieldName: string[]): WixDataAggregate\n\n /**\n * Filters out groups from being returned from an aggregation.\n *\n * The `having()` function 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()` function.\n *\n * Filtering using `having()` takes place after grouping is performed on the\n * aggregation. To filter items before grouping, use the `filter()` function.\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 filterBuilder - The filter to use to filter out groups from being returned from the aggregation.\n * @requiredField filterBuilder\n * @returns A `WixDataAggregate` object representing the refined aggregation.\n */\n having(filterBuilder: WixDataFilter): WixDataAggregate\n\n /**\n * Limits the number of items or groups the aggregation returns.\n *\n * The `limit()` function 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 * function 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\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 limitNumber - The number of items or groups to return.\n * @requiredField limitNumber\n * @returns A `WixDataAggregate` object representing the refined aggregation.\n */\n limit(limitNumber: number): WixDataAggregate\n\n /**\n * Sets the number of items or groups to skip before returning aggregation results.\n *\n * The `skip()` function 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 skipNumber - The number of items or groups to skip in the aggregation results before returning the results.\n * @requiredField skipNumber\n * @returns A `WixDataAggregate` object representing the refined aggregation.\n */\n skip(skipNumber: number): WixDataAggregate\n\n /**\n * Adds a sort to a query or sort, sorting by the specified properties in descending order.\n *\n * The `descending()` function 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 will be 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 - The properties used in the sort.\n * @requiredField fields\n * @returns An object representing the 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 properties in ascending order.\n *\n * The `ascending()` function 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 will be 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 - The properties used in the sort.\n * @requiredField fields\n * @returns An object representing the 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()` function 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://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).\n * @public\n * @documentationMaturity preview\n * @param options - Options to use when running an aggregation.\n * @returns A Promise that resolves to the results of the aggregation.\n */\n run(options?: WixDataReadOptions): Promise<WixDataResult<Record<string, any>>>\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["../../../src/api/WixDataAggregate.ts"],"sourcesContent":["import { WixDataFilter } from './WixDataFilter'\nimport { WixDataReadOptions } 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://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).\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://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).\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://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).\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://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).\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://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).\n * @public\n * @documentationMaturity preview\n * @param projectedField - Field in the aggregation results that contains the count value. Defaults to `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://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).\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\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 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\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 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://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).\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(options?: WixDataReadOptions): Promise<WixDataResult<Record<string, any>>>\n}\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../../src/api/WixDataFilter.ts"],"sourcesContent":["type Comparable = string | number | Date\n\n/**\n * @builder\n */\nexport interface WixDataFilter {\n /**\n * Refines a filter to match items whose specified property value equals the specified value.\n *\n * The `eq()` function refines this filter to only\n * match items where the 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 - The property whose value will be compared with `value`.\n * @requiredField field\n * @param value - The value to match against.\n * @requiredField value\n * @returns An object representing the refined filter.\n */\n eq(field: string, value: any): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified property value does not equal the specified value.\n *\n * The `ne()` function refines this filter 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 - The property whose value will be compared with `value`.\n * @requiredField field\n * @param value - The value to match against.\n * @requiredField value\n * @returns An object representing the refined filter.\n */\n ne(field: string, value: any): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified property value is greater than or equal to the specified\n * value.\n *\n * The `ge()` function refines this filter 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 will be 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 - The property whose value will be compared with `value`.\n * @requiredField field\n * @param value - The value to match against.\n * @requiredField value\n * @returns An object representing the refined filter.\n */\n ge(field: string, value: Comparable): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified property value is greater than the specified value.\n *\n * The `gt()` function refines this filter 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 will be 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 - The property whose value will be compared with `value`.\n * @requiredField field\n * @param value - The value to match against.\n * @requiredField value\n * @returns An object with the filter definition, based on the supplied parameters.\n */\n gt(field: string, value: Comparable): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified property value is less than or equal to the specified\n * value.\n *\n * The `le()` function refines this filter 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 will be 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 - The property whose value will be compared with `value`.\n * @requiredField field\n * @param value - The value to match against.\n * @requiredField value\n * @returns An object representing the refined filter.\n */\n le(field: string, value: Comparable): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified property value is less than the specified value.\n *\n * The `lt()` function refines this filter 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 will be 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 - The property whose value will be compared with `value`.\n * @requiredField field\n * @param value - The value to match against.\n * @requiredField value\n * @returns An object with the filter definition, based on the supplied parameters.\n */\n lt(field: string, value: Comparable): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified property has any value.\n *\n * The `isNotEmpty()` function refines this filter 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 filter.\n * @public\n * @documentationMaturity preview\n * @param field - The property in which to check for a value.\n * @requiredField field\n * @returns An object representing the refined filter.\n */\n isNotEmpty(field: string): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified property does not exist or does not have any value.\n *\n * The `isEmpty()` function refines this filter 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 filter.\n * @public\n * @documentationMaturity preview\n * @param field - The property 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 property value starts with a specified string.\n *\n * The `startsWith()` function refines this filter 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 - The property whose value will be compared with the `value` parameter.\n * @requiredField field\n * @param value - The string to look for at the beginning of the specified property value.\n * @requiredField value\n * @returns An object representing the refined filter.\n */\n startsWith(field: string, value: string): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified property value ends with a specified string.\n *\n * The `endsWith()` function refines this filter 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 - The property whose value will be compared with the string.\n * @requiredField field\n * @param value - The string to look for at the end of the specified property value.\n * @requiredField value\n * @returns An object representing the refined filter.\n */\n endsWith(field: string, value: string): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified property value contains a specified string.\n *\n * The `contains()` function refines this filter 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 * function 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 - The property whose value will be 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 An object representing the refined filter.\n */\n contains(field: string, value: string): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified property value equals any of the specified `values`\n * parameters.\n *\n * The `hasSome()` function refines this filter 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 - The property whose value will be compared with `value`.\n * @requiredField field\n * @param values - The values to match against.\n * @requiredField values\n * @returns An object representing the refined filter.\n */\n hasSome(field: string, ...values: Comparable[]): WixDataFilter\n\n /**\n * Overload for `hasSome()`\n * @public\n * @documentationMaturity preview\n */\n hasSome(field: string, values: Comparable[]): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified property values equals all of the specified `value`\n * parameters.\n *\n * The `hasAll()` function refines this filter 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 - The property whose value will be compared with `value`.\n * @requiredField field\n * @param values - The values to match against.\n * @requiredField values\n * @returns An object representing the refined filter.\n */\n hasAll(field: string, ...values: Comparable[]): WixDataFilter\n\n /**\n * Overload for `hasAll()`\n * @public\n * @documentationMaturity preview\n */\n hasAll(field: string, values: Comparable[]): WixDataFilter\n\n /**\n * Adds an `or` condition to the filter.\n *\n * The `or()` function 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` function, the items that match the filter passed to the `or`\n * function, and the items that match both.\n *\n * The 'or()' function 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 - A filter to add to the initial filter as an `or` condition.\n * @requiredField filter\n * @returns An object representing the refined filter.\n */\n or(filter: WixDataFilter): WixDataFilter\n\n /**\n * Adds an `and` condition to the filter.\n *\n * The `and()` function adds an and condition to this filter. A filter with an `and` returns all the items\n * that match the filter as defined up to the `and` function and also match the filter passed to\n * the `and` function.\n *\n * Note that when chaining multiple `WixDataFilter` functions to a filter an and condition is assumed. In such cases,\n * you do not need to add a call to the `and()` function. For example, this filter returns results where status is\n * active **and** age is greater than 25.\n * ```js\n * wixClient.items.filter().eq(\"status\", \"active\").gt(\"age\", 25);\n * ```\n *\n * The `and()` function is needed 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 * ```js\n * let statusFilter = wixClient.items.filter()\n * .eq(\"status\", \"pending\")\n * .or(wixClient.items.filter().eq(\"status\", \"rejected\"));\n *\n * let ageFilter = wixClient.items.filter()\n * .lt(\"age\", 25)\n * .or(wixData.items.filter().gt(\"age\", 65));\n *\n * let statusAndAgeFilter = statusFilter.and(ageFilter);\n * ```\n *\n * The `and()` function is designed to work with 2 or more queries or filters. If you use it on its own, it will\n * return all the items in a collection.\n * @public\n * @documentationMaturity preview\n * @param filter - A filter to add to the initial filter as an `and` condition.\n * @requiredField filter\n * @returns An object representing the refined filter.\n */\n and(filter: WixDataFilter): WixDataFilter\n\n /**\n * Adds a `not` condition to the filter.\n *\n * The `not()` function 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 * function, but don't match the filter passed to the `not` function.\n *\n * If the filter only contains a `not()` function, 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 - A filter to add to the initial filter as a `not` condition.\n * @requiredField filter\n * @returns An object representing the refined filter.\n */\n not(filter: WixDataFilter): WixDataFilter\n\n /**\n * Refines a filter to match items whose specified property value is within a specified range.\n *\n * The `between()` function refines this filter 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 will be 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 - The property whose value will be compared with rangeStart and rangeEnd.\n * @requiredField field\n * @param rangeStart - The beginning value of the range to match against.\n * @requiredField rangeStart\n * @param rangeEnd - The ending value of the range to match against.\n * @requiredField rangeEnd\n * @returns An object representing the refined filter.\n */\n between<T extends Comparable>(\n field: string,\n rangeStart: T,\n rangeEnd: T\n ): WixDataFilter\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["../../../src/api/WixDataFilter.ts"],"sourcesContent":["type Comparable = string | number | Date\n\n/**\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\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 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: Comparable): 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: Comparable): 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: Comparable): 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: Comparable): 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: Comparable[]): WixDataFilter\n\n /**\n * Overload for `hasSome()`\n * @public\n * @documentationMaturity preview\n */\n hasSome(field: string, values: Comparable[]): 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: Comparable[]): WixDataFilter\n\n /**\n * Overload for `hasAll()`\n * @public\n * @documentationMaturity preview\n */\n hasAll(field: string, values: Comparable[]): 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 - A filter to add to the initial filter as an `or` condition.\n * @requiredField filter\n * @returns An 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 = wixClient.items.filter()\n * .eq(\"status\", \"pending\")\n * .or(wixClient.items.filter().eq(\"status\", \"rejected\"));\n *\n * let ageFilter = wixClient.items.filter()\n * .lt(\"age\", 25)\n * .or(wixData.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 * wixClient.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 - A filter to add to the initial filter as a `not` condition.\n * @requiredField filter\n * @returns An 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 matches 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 *\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 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 filter.\n */\n between<T extends Comparable>(\n field: string,\n rangeStart: T,\n rangeEnd: T\n ): WixDataFilter\n}\n"],"mappings":""}
@@ -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\ntype Comparable = string | number | Date\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()` function 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 will be 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 - The properties used in the sort.\n * @requiredField fields\n * @returns An object representing the 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()` function 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 will be 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 - The properties used in the sort.\n * @requiredField fields\n * @returns An object representing the 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()` function refines this query to only\n * match items where the 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 - The property whose value will be compared with `value`.\n * @requiredField field\n * @param value - The value to match against.\n * @requiredField value\n * @returns An object representing the 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()` function 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 - The property whose value will be compared with `value`.\n * @requiredField field\n * @param value - The value to match against.\n * @requiredField value\n * @returns An object representing the 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()` function 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 will be 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 - The property whose value will be compared with `value`.\n * @requiredField field\n * @param value - The value to match against.\n * @requiredField value\n * @returns An object representing the refined query.\n */\n ge(field: string, value: Comparable): WixDataQuery\n\n /**\n * Refines a query to match items whose specified property value is greater than the specified value.\n *\n * The `gt()` function 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 will be 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 - The property whose value will be compared with `value`.\n * @requiredField field\n * @param value - The value to match against.\n * @requiredField value\n * @returns An object with the query definition, based on the supplied parameters.\n */\n gt(field: string, value: Comparable): 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()` function 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 will be 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 - The property whose value will be compared with `value`.\n * @requiredField field\n * @param value - The value to match against.\n * @requiredField value\n * @returns An object representing the refined query.\n */\n le(field: string, value: Comparable): WixDataQuery\n\n /**\n * Refines a query to match items whose specified property value is less than the specified value.\n *\n * The `lt()` function 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 will be 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 - The property whose value will be compared with `value`.\n * @requiredField field\n * @param value - The value to match against.\n * @requiredField value\n * @returns An object with the query definition, based on the supplied parameters.\n */\n lt(field: string, value: Comparable): WixDataQuery\n\n /**\n * Refines a query to match items whose specified property has any value.\n *\n * The `isNotEmpty()` function 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 - The property in which to check for a value.\n * @requiredField field\n * @returns An object representing the 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()` function 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 - The property in which to check for a value.\n * @requiredField field\n * @returns An object representing the 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()` function 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 - The property whose value will be compared with the `value` parameter.\n * @requiredField field\n * @param value - The string to look for at the beginning of the specified property value.\n * @requiredField value\n * @returns A `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()` function 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 - The property whose value will be compared with the string.\n * @requiredField field\n * @param value - The string to look for at the end of the specified property value.\n * @requiredField value\n * @returns A `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()` function 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 * function 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 - The property whose value will be 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 An object representing the 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()` function 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 - The property whose value will be compared with `value`.\n * @requiredField field\n * @param values - The values to match against.\n * @requiredField values\n * @returns An object representing the refined query.\n */\n hasSome(field: string, ...values: Comparable[]): WixDataQuery\n\n /**\n * Overload for `hasSome()`\n * @public\n * @documentationMaturity preview\n */\n hasSome(field: string, values: Comparable[]): 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()` function 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 - The property whose value will be compared with `value`.\n * @requiredField field\n * @param values - The values to match against.\n * @requiredField values\n * @returns An object representing the refined query.\n */\n hasAll(field: string, ...values: Comparable[]): WixDataQuery\n\n /**\n * Overload for `hasAll()`\n * @public\n * @documentationMaturity preview\n */\n hasAll(field: string, values: Comparable[]): WixDataQuery\n\n /**\n * Adds an `or` condition to the query or filter.\n *\n * The `or()` function 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` function, the items that match the query or filter passed to the `or`\n * function, and the items that match both.\n *\n * The 'or()' function 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 - A filter to add to the initial filter as an `or` condition.\n * @requiredField filter\n * @returns An object representing the refined query.\n */\n or(filter: WixDataFilter): WixDataQuery\n\n /**\n * Adds an `and` condition to the query or filter.\n *\n * The `and()` function 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` function and also match the query or filter passed to\n * the `and` function.\n *\n * Note that when chaining multiple `WixDataFilter` functions to a query an and condition is assumed. In such cases,\n * you do not need to add a call to the `and()` function. For example, this query returns results where status is\n * active **and** age is greater than 25.\n * ```js\n * wixClient.items.query(\"myCollection\").eq(\"status\", \"active\").gt(\"age\", 25);\n * ```\n *\n * The `and()` function 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 = wixClient.items\n * .query(\"myCollection\")\n * .eq(\"status\", \"pending\")\n * .or(wixClient.items.filter().eq(\"status\", \"rejected\"));\n *\n * let ageQuery = wixClient.items\n * .filter()\n * .lt(\"age\", 25)\n * .or(wixClient.items.filter().gt(\"age\", 65));\n *\n * let statusAndAgeQuery = statusQuery.and(ageQuery);\n * ```\n *\n * The `and()` function is designed to work with 2 or more queries or filters. If you use it on its own, it will\n * return all the items in a collection.\n * @public\n * @documentationMaturity preview\n * @param filter - A filter to add to the initial query as an `and` condition.\n * @requiredField filter\n * @returns An object representing the refined query.\n */\n and(filter: WixDataFilter): WixDataQuery\n\n /**\n * Adds a `not` condition to the query or filter.\n *\n * The `not()` function 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 * function, but don't match the filter passed to the `not` function.\n *\n * If the query only contains a `not()` function, 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 - A filter to add to the initial filter as a `not` condition.\n * @requiredField filter\n * @returns An object representing the 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()` function 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 will be 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 - The property whose value will be compared with rangeStart and rangeEnd.\n * @requiredField field\n * @param rangeStart - The beginning value of the range to match against.\n * @requiredField rangeStart\n * @param rangeEnd - The ending value of the range to match against.\n * @requiredField rangeEnd\n * @returns An object representing the refined query.\n */\n between<T extends Comparable>(\n field: string,\n rangeStart: T,\n rangeEnd: T\n ): WixDataQuery\n\n /**\n * Returns the number of items that match the query.\n *\n * The `count()` function 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 functions used to refine the\n * query is invalid.\n *\n * Calling the `count()` function triggers the `beforeCount()` and `afterCount()` 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 function 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` functions,\n * `count()` returns the total number of items in the collection.\n *\n * If you have already run a query with `find()`, you can retrieve the number of query results without calling\n * `count()`.\n * @public\n * @documentationMaturity preview\n * @param options - An object containing options to use when processing this operation.\n * @returns The 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()` function 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 * functions 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)\n * permissions can retrieve and view data. You can override the permissions in backend code by setting the\n * `suppressAuth` option to `true`.\n * @public\n * @documentationMaturity preview\n * @param field - The property whose value will be compared for distinct values.\n * @requiredField field\n * @param options - An object containing options to use when processing this operation.\n * @returns A 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()` function 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 * functions used to refine the query is invalid.\n *\n * Calling the `find()` function triggers the `beforeQuery()` and `afterQuery()` 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\n * > collections.\n *\n * Use the `options` parameter to override default preferences:\n * - Override permission checks with `suppressAuth`.\n * - Ensure the most up-to-date data is retrieved with `consistentRead`.\n * - Prevent hooks from running with `suppressHooks`.\n * - Speed up execution with `omitTotalCount`, if you don't need a count of items matching the query.\n *\n * If you build a query and don't refine it with any `wixDataQuery` functions,\n * `find()` returns the entire collection.\n * @public\n * @documentationMaturity preview\n * @param options - An object containing options to use when processing this operation.\n * @returns A 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()` function 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()` function 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()` functions 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, 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 - The number of items to return, which is also the `pageSize` of the results object.\n * @requiredField limitNumber\n * @returns A `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()` function 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 skipNumber - The number of items to skip in the query results before returning the results.\n * @requiredField skipNumber\n * @returns A `WixDataQuery` object representing the refined query.\n */\n skip(skipNumber: number): WixDataQuery\n\n /**\n * Includes referenced items for the specified properties in a query's results.\n *\n * The `include()` function 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()` function:\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()` function.\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()` function.\n *\n * For a discussion of when to use the similar `queryReferenced()`\n * function 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 * > **Notes:**\n * > - Calling the `include()` function does not trigger any hooks.\n * > - The `include()` function is not supported for Single Item Collections.\n * @public\n * @documentationMaturity preview\n * @param fieldNames - The properties for which to include referenced items.\n * @requiredField fieldNames\n * @returns A `WixDataQuery` object representing the query.\n */\n include(...fieldNames: string[]): WixDataQuery\n\n /**\n * Overload for `include()`\n * @public\n * @documentationMaturity preview\n */\n include(fieldName: string, limit?: number): WixDataQuery\n\n /**\n * Overload for `include()`\n * @public\n * @documentationMaturity preview\n */\n include(fieldName1: string, fieldName2: string, limit?: number): WixDataQuery\n\n /**\n * Overload for `include()`\n * @public\n * @documentationMaturity preview\n */\n include(\n fieldName1: string,\n fieldName2: string,\n fieldName3: string,\n limit?: number\n ): WixDataQuery\n\n /**\n * Overload for `include()`\n * @public\n * @documentationMaturity preview\n */\n include(\n fieldName1: string,\n fieldName2: string,\n fieldName3: string,\n fieldName4: string,\n limit?: number\n ): WixDataQuery\n\n /**\n * Overload for `include()`\n * @public\n * @documentationMaturity preview\n */\n include(\n fieldName1: string,\n fieldName2: string,\n fieldName3: string,\n fieldName4: string,\n fieldName5: 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 /**\n * Overload for `include()`\n * @public\n * @documentationMaturity preview\n */\n include(...args: unknown[]): WixDataQuery\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["../../../src/api/WixDataQuery.ts"],"sourcesContent":["import { WixDataQueryOptions, WixDataReadOptions } from './types'\nimport { WixDataResult } from './WixDataResult'\nimport { WixDataFilter } from './WixDataFilter'\n\ntype Comparable = string | number | Date\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: Comparable): 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: Comparable): 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: Comparable): 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: Comparable): 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 - The string to look for at the beginning of the specified property value.\n * @requiredField value\n * @returns A `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 - The string to look for at the end of the specified property value.\n * @requiredField value\n * @returns A `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: Comparable[]): WixDataQuery\n\n /**\n * Overload for `hasSome()`\n * @public\n * @documentationMaturity preview\n */\n hasSome(field: string, values: Comparable[]): 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: Comparable[]): WixDataQuery\n\n /**\n * Overload for `hasAll()`\n * @public\n * @documentationMaturity preview\n */\n hasAll(field: string, values: Comparable[]): 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.\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 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 * wixClient.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 = wixClient.items\n * .query(\"myCollection\")\n * .eq(\"status\", \"pending\")\n * .or(wixClient.items.filter().eq(\"status\", \"rejected\"));\n *\n * let ageQuery = wixClient.items\n * .filter()\n * .lt(\"age\", 25)\n * .or(wixClient.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<T extends Comparable>(\n field: string,\n rangeStart: T,\n rangeEnd: T\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()` and `afterCount()` 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 `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)\n * permissions can retrieve and view data. You can override the permissions in backend code by setting the\n * `suppressAuth` option to `true`.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared for distinct values.\n * @requiredField field\n * @param options - An object containing options to use when processing this operation.\n * @returns A 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()` and `afterQuery()` 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\n * > collections.\n *\n * Use the `options` parameter to override default preferences:\n * - Override permission checks with `suppressAuth`.\n * - Ensure the most up-to-date data is retrieved with `consistentRead`.\n * - Prevent hooks from running with `suppressHooks`.\n * - Speed up execution with `omitTotalCount`, if you don't need a count of items matching the query.\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 - Options to use when processing this operation.\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, 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 * > **Notes:**\n * > - Calling the `include()` method does not trigger any hooks.\n * > - The `include()` method is not supported for Single Item Collections.\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 /**\n * Overload for `include()`\n * @public\n * @documentationMaturity preview\n */\n include(...args: unknown[]): WixDataQuery\n}\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../../src/api/WixDataResult.ts"],"sourcesContent":["import { WixDataItem } from './types'\n\n/**\n * @builder\n */\nexport interface WixDataResult<Item = WixDataItem> {\n // query is not implemented\n\n /**\n * Returns the items that match the query.\n *\n * The current page of items retrieved by the query.\n *\n * The page size is defined by the `limit()`\n * function, can be retrieved using the `pageSize` property, and\n * navigating through pages is done with the `prev()` and\n * `next()` functions.\n *\n * When no items match the query, the `items` array is empty.\n * @public\n * @documentationMaturity preview\n * @readonly\n */\n readonly items: Item[]\n\n /**\n * Returns the total number of items that match the query.\n *\n * The `totalCount` returns the total number of items that match the query,\n * not just the number of items in the current page.\n *\n * > **Note:** available when requested with returnTotalCount = true\n * @public\n * @documentationMaturity preview\n * @readonly\n */\n readonly totalCount: number | undefined\n\n /**\n * Returns the query page size.\n *\n * The page size is defined by the `limit()`\n * function, can be retrieved using the `pageSize` property, and\n * navigating through pages is done with the `prev()` and\n * `next()` functions.\n * @public\n * @documentationMaturity preview\n * @readonly\n */\n readonly pageSize: number | undefined\n\n /**\n * Returns the index of the current results page number.\n *\n * The `currentPage` is a zero-based index of the current page of results.\n *\n * The page size is defined by the `limit()`\n * function, can be retrieved using the `pageSize` property, and\n * navigating through pages is done with the `prev()` and\n * `next()` functions.\n *\n * The `currentPage` property returns `undefined` if the query returned no results.\n * @public\n * @documentationMaturity preview\n * @readonly\n */\n readonly currentPage: number | undefined\n\n /**\n * Returns the number of items in the current results page.\n *\n * The page size is defined by the `limit()`\n * function, can be retrieved using the `pageSize` property, and\n * navigating through pages is done with the `prev()` and\n * `next()` functions.\n * @public\n * @documentationMaturity preview\n * @readonly\n */\n readonly length: number\n\n /**\n * Returns the total number of pages the query produced.\n *\n * The page size is defined by the `limit()`\n * function, can be retrieved using the `pageSize` property, and\n * navigating through pages is done with the `prev()` and\n * `next()` functions.\n *\n * > **Note:** available when requested with returnTotalCount = true\n * @public\n * @documentationMaturity preview\n * @readonly\n */\n readonly totalPages: number | undefined\n\n /**\n * Retrieves the next page of query results.\n *\n * The `next()` function retrieves the next page of query results.\n *\n * The page size is defined by the `limit()`\n * function, can be retrieved using the `pageSize` property, and\n * navigating through pages is done with the `prev()` and\n * `next()` functions.\n *\n * If items are added or removed between calls to `next()` the values returned may change.\n *\n * >**Note:** The `next()` function is not supported for Single Item Collections.\n *\n * @public\n * @documentationMaturity preview\n * @returns A query result object with the next page of query results.\n */\n next(): Promise<WixDataResult<Item>>\n\n /**\n * Retrieves the previous page of query results.\n *\n * The `prev()` function retrieves the previous page of query results.\n *\n * The page size is defined by the `limit()`\n * function, can be retrieved using the `pageSize` property, and\n * navigating through pages is done with the `prev()` and\n * `next()` functions.\n *\n * If items are added or removed between calls to `prev()` the values returned\n * may change.\n *\n * >**Note:** The `prev()` function is not supported for Single Item Collections.\n *\n * @public\n * @documentationMaturity preview\n * @returns A query result object with the previous page of query results.\n */\n prev(): Promise<WixDataResult<Item>>\n\n /**\n * Indicates if the query has more results.\n *\n * @public\n * @documentationMaturity preview\n * @returns `true` if there are more results.\n */\n hasNext(): boolean\n\n /**\n * Indicates the query has previous results.\n *\n * @public\n * @documentationMaturity preview\n * @returns `true` if there are previous results.\n */\n hasPrev(): boolean\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["../../../src/api/WixDataResult.ts"],"sourcesContent":["import { WixDataItem } from './types'\n\n/**\n * @builder\n */\nexport interface WixDataResult<Item = WixDataItem> {\n // query is not implemented\n\n /**\n * Returns the items that match the query.\n *\n * The current page of items retrieved by the query.\n *\n * The page size is defined by the `limit()`\n * method, can be retrieved using the `pageSize` property, and\n * navigating through pages is done with the `prev()` and\n * `next()` methods.\n *\n * When no items match the query, the `items` array is empty.\n * @public\n * @documentationMaturity preview\n * @readonly\n */\n readonly items: Item[]\n\n /**\n * Returns the total number of items that match the query.\n *\n * The `totalCount` returns the total number of items that match the query,\n * not just the number of items in the current page.\n *\n * > **Note:** available when requested with returnTotalCount = true\n * @public\n * @documentationMaturity preview\n * @readonly\n */\n readonly totalCount: number | undefined\n\n /**\n * Returns the query page size.\n *\n * The page size is defined by the `limit()`\n * method, can be retrieved using the `pageSize` property, and\n * navigating through pages is done with the `prev()` and\n * `next()` methods.\n * @public\n * @documentationMaturity preview\n * @readonly\n */\n readonly pageSize: number | undefined\n\n /**\n * Returns the index of the current results page number.\n *\n * The `currentPage` is a zero-based index of the current page of results.\n *\n * The page size is defined by the `limit()`\n * method, can be retrieved using the `pageSize` property, and\n * navigating through pages is done with the `prev()` and\n * `next()` methods.\n *\n * The `currentPage` property returns `undefined` if the query returned no results.\n * @public\n * @documentationMaturity preview\n * @readonly\n */\n readonly currentPage: number | undefined\n\n /**\n * Returns the number of items in the current results page.\n *\n * The page size is defined by the `limit()`\n * method, can be retrieved using the `pageSize` property, and\n * navigating through pages is done with the `prev()` and\n * `next()` methods.\n * @public\n * @documentationMaturity preview\n * @readonly\n */\n readonly length: number\n\n /**\n * Returns the total number of pages the query produced.\n *\n * The page size is defined by the `limit()`\n * method, can be retrieved using the `pageSize` property, and\n * navigating through pages is done with the `prev()` and\n * `next()` methods.\n *\n * > **Note:** available when requested with returnTotalCount = true\n * @public\n * @documentationMaturity preview\n * @readonly\n */\n readonly totalPages: number | undefined\n\n /**\n * Retrieves the next page of query results.\n *\n * The `next()` method retrieves the next page of query results.\n *\n * The page size is defined by the `limit()`\n * method, can be retrieved using the `pageSize` property, and\n * navigating through pages is done with the `prev()` and\n * `next()` methods.\n *\n * If items are added or removed between calls to `next()` the values returned may change.\n *\n * >**Note:** The `next()` method is not supported for Single Item Collections.\n *\n * @public\n * @documentationMaturity preview\n * @returns A query result object with the next page of query results.\n */\n next(): Promise<WixDataResult<Item>>\n\n /**\n * Retrieves the previous page of query results.\n *\n * The `prev()` method retrieves the previous page of query results.\n *\n * The page size is defined by the `limit()`\n * method, can be retrieved using the `pageSize` property, and\n * navigating through pages is done with the `prev()` and\n * `next()` methods.\n *\n * If items are added or removed between calls to `prev()` the values returned\n * may change.\n *\n * >**Note:** The `prev()` method is not supported for Single Item Collections.\n *\n * @public\n * @documentationMaturity preview\n * @returns A query result object with the previous page of query results.\n */\n prev(): Promise<WixDataResult<Item>>\n\n /**\n * Indicates if the query has more results.\n *\n * @public\n * @documentationMaturity preview\n * @returns `true` if there are more results.\n */\n hasNext(): boolean\n\n /**\n * Indicates the query has previous results.\n *\n * @public\n * @documentationMaturity preview\n * @returns `true` if there are previous results.\n */\n hasPrev(): boolean\n}\n"],"mappings":""}