@wix/wix-data-items-common 1.0.186 → 1.0.188
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.
|
@@ -5,6 +5,9 @@ exports.FilterStageImpl = void 0;
|
|
|
5
5
|
var _QueryBase = require("../QueryBase");
|
|
6
6
|
/**
|
|
7
7
|
* @builder
|
|
8
|
+
* Filter stage for aggregate pipeline operations. This interface provides filtering capabilities
|
|
9
|
+
* specifically designed for use within aggregate pipelines, typically used with `stages.filter()`
|
|
10
|
+
* in pipeline arrays to refine data based on specified conditions.
|
|
8
11
|
*/
|
|
9
12
|
|
|
10
13
|
class FilterStageImpl extends _QueryBase.QueryBase {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_QueryBase","require","FilterStageImpl","QueryBase","constructor","origin","collectionName","filterBuilder","copy","params","invalidArguments","toProto","filter","build","exports"],"sources":["../../../../src/api/stages/FilterStage.ts"],"sourcesContent":["import { QueryBase } from '../QueryBase'\nimport { PlatformizedFilterBuilder, WithFilter } from '../../filter'\nimport * as apiTypes from '../../types/data-item-types'\nimport { PipelineStage } from './stages'\n\ntype Comparable = string | number | Date\n\n/**\n * @builder\n */\nexport interface FilterStage extends PipelineStage, WithFilter<FilterStage> {\n /**\n * @internal\n */\n readonly filterTree: Record<string, any>\n\n /**\n * @internal\n */\n readonly invalidArguments: string[]\n\n /**\n * Refines a filter to match items whose specified field value equals the specified value.\n *\n * The `eq()` method refines this filter to only\n * match items where the value of the specified field equals the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * Matching strings with `eq()` is case sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If `field` points to a collection field of type array, `eq()` includes the item as long as at least one array element matches the specified `value`.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to compare with.\n * @requiredField value\n * @returns Refined filter.\n */\n eq(field: string, value: any): FilterStage\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): FilterStage\n\n /**\n * Refines a filter to match items whose specified field value is greater than or equal to the specified\n * value.\n *\n * The `ge()` method refines this filter to only\n * match items where the value of the specified field is greater than or\n * equal to the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified field are ranked lowest.\n *\n * The following field types can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically,\n * so `\"abc\"` is greater than or equal to `\"ABC\"` (because of the greater than),\n * but `\"ABC\"` is not greater than or equal to `\"abc\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns Refined filter.\n */\n ge(field: string, value: string | number | Date): FilterStage\n\n /**\n * Refines a filter to match items whose specified field value is greater than the specified value.\n *\n * The `gt()` method refines this filter to only match\n * items where the value of the specified field is greater than the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified field are ranked lowest.\n *\n * The following field types can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"text\"` is greater than `\"Text\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns An object with the filter definition, based on the supplied parameters.\n */\n gt(field: string, value: string | number | Date): FilterStage\n\n /**\n * Refines a filter to match items whose specified field value is less than or equal to the specified\n * value.\n *\n * The `le()` method refines this filter to only match\n * items where the value of the specified field is less than or equal to the\n * specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified field are ranked lowest.\n *\n * The following field types can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically,\n * so `\"ABC\"` is less than or equal to `\"abc\"` (because of the less than),\n * but `\"abc\"` is not less than or equal to `\"ABC\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns Refined filter.\n */\n le(field: string, value: string | number | Date): FilterStage\n\n /**\n * Refines a filter to match items whose specified field value is less than the specified value.\n *\n * The `lt()` method refines this filter to only match\n * items where the value of the specified field is less than the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified field are ranked lowest.\n *\n * The following field types can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"Text\"` is less than `\"text\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns An object with the filter definition, based on the supplied parameters.\n */\n lt(field: string, value: string | number | Date): FilterStage\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): FilterStage\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): FilterStage\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): FilterStage\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): FilterStage\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): FilterStage\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[]): FilterStage\n\n /**\n * Overload for `hasSome()`\n * @public\n * @documentationMaturity preview\n */\n hasSome(field: string, values: Comparable[]): FilterStage\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[]): FilterStage\n\n /**\n * Overload for `hasAll()`\n * @public\n * @documentationMaturity preview\n */\n hasAll(field: string, values: Comparable[]): FilterStage\n\n /**\n * Adds an `or` condition to the filter.\n *\n * The `or()` method adds an inclusive `or` condition to this filter. A filter\n * with an `or` returns all the items that match the filter as defined up to\n * the `or` method, the items that match the filter passed to the `or`\n * method, and the items that match both.\n *\n * The `or()` method is designed to work with 2 or more queries or filters.\n * If you use it on its own, it will return all the items in a collection.\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial filter as an `or` condition.\n * @requiredField filter\n * @returns Object representing the refined filter.\n */\n or(filter: FilterStage): FilterStage\n\n /**\n * Adds an `and` condition to the filter.\n *\n * A filter with an `and` condition returns all items that meet the conditions defined on both sides of the condition.\n *\n * Use the `and()` method when performing compound queries. For example, the final filter in this set of\n * queries returns results where status is either pending or rejected **and** age is either less than 25 or greater\n * than 65.\n *\n * ```js\n * let statusFilter = items.filter()\n * .eq(\"status\", \"pending\")\n * .or(items.filter().eq(\"status\", \"rejected\"));\n *\n * let ageFilter = items.filter()\n * .lt(\"age\", 25)\n * .or(items.filter().gt(\"age\", 65));\n *\n * let statusAndAgeFilter = statusFilter.and(ageFilter);\n * ```\n *\n * > **Notes**:\n * > - The `and()` method is designed to work with 2 or more queries or filters. If used with a single query or filter, it returns all items in a collection.\n * > - When chaining multiple `FilterStage` methods to a filter, an `and` condition is implied. In such cases, you do not need to call the `and()` method explicitly. For example, this filter returns results where an item `status` is `active` and `age` is greater than 25:\n *\n * ```js\n * items.filter().eq(\"status\", \"active\").gt(\"age\", 25);\n * ```\n *\n * @public\n * @documentationMaturity preview\n * @param filter - `FilterStage` used with an `and` condition.\n * @requiredField filter\n * @returns The compound filter.\n */\n and(filter: FilterStage): FilterStage\n\n /**\n * Adds a `not` condition to the filter.\n *\n * The `not()` method adds a `not` condition to this filter. A filter with a `not`\n * returns all the items that match the filter as defined up to the `not`\n * method, but don't match the filter passed to the `not` method.\n *\n * If the filter only contains a `not()` method, it returns all the items\n * that don't match the filter defined by the `not` method.\n *\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial filter as a `not` condition.\n * @requiredField filter\n * @returns Object representing the refined filter.\n */\n not(filter: FilterStage): FilterStage\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 * > **Note**: Items that do not have a value for the specified field are considered as the lowest comparable value and are ranked last.\n *\n * @public\n * @documentationMaturity preview\n * @param field - Field to compare with `rangeStart` and `rangeEnd`.\n * @requiredField field\n * @param rangeStart - Starting value of the range to match.\n * @requiredField rangeStart\n * @param rangeEnd - Ending value of the range to match.\n * @requiredField rangeEnd\n * @returns Refined filter.\n */\n between(\n field: string,\n rangeStart: string | number | Date,\n rangeEnd: string | number | Date\n ): FilterStage\n}\n\nexport class FilterStageImpl\n extends QueryBase<FilterStageImpl>\n implements FilterStage\n{\n constructor(origin?: {\n collectionName?: string\n filterBuilder?: PlatformizedFilterBuilder\n }) {\n super({\n collectionName: origin?.collectionName || '',\n filterBuilder: origin?.filterBuilder,\n })\n }\n\n protected copy(params: any): FilterStageImpl {\n return new FilterStageImpl({\n collectionName: this.collectionName,\n filterBuilder: params.filterBuilder || this.filterBuilder,\n })\n }\n\n get invalidArguments(): string[] {\n return []\n }\n\n toProto(): apiTypes.Stage {\n return { filter: this.filterBuilder.build() }\n }\n}\n"],"mappings":";;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAOA;AACA;AACA;;AAubO,MAAMC,eAAe,SAClBC,oBAAS,CAEnB;EACEC,WAAWA,CAACC,MAGX,EAAE;IACD,KAAK,CAAC;MACJC,cAAc,EAAE,CAAAD,MAAM,oBAANA,MAAM,CAAEC,cAAc,KAAI,EAAE;MAC5CC,aAAa,EAAEF,MAAM,oBAANA,MAAM,CAAEE;IACzB,CAAC,CAAC;EACJ;EAEUC,IAAIA,CAACC,MAAW,EAAmB;IAC3C,OAAO,IAAIP,eAAe,CAAC;MACzBI,cAAc,EAAE,IAAI,CAACA,cAAc;MACnCC,aAAa,EAAEE,MAAM,CAACF,aAAa,IAAI,IAAI,CAACA;IAC9C,CAAC,CAAC;EACJ;EAEA,IAAIG,gBAAgBA,CAAA,EAAa;IAC/B,OAAO,EAAE;EACX;EAEAC,OAAOA,CAAA,EAAmB;IACxB,OAAO;MAAEC,MAAM,EAAE,IAAI,CAACL,aAAa,CAACM,KAAK,CAAC;IAAE,CAAC;EAC/C;AACF;AAACC,OAAA,CAAAZ,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_QueryBase","require","FilterStageImpl","QueryBase","constructor","origin","collectionName","filterBuilder","copy","params","invalidArguments","toProto","filter","build","exports"],"sources":["../../../../src/api/stages/FilterStage.ts"],"sourcesContent":["import { QueryBase } from '../QueryBase'\nimport { PlatformizedFilterBuilder, WithFilter } from '../../filter'\nimport * as apiTypes from '../../types/data-item-types'\nimport { PipelineStage } from './stages'\n\ntype Comparable = string | number | Date\n\n/**\n * @builder\n * Filter stage for aggregate pipeline operations. This interface provides filtering capabilities\n * specifically designed for use within aggregate pipelines, typically used with `stages.filter()`\n * in pipeline arrays to refine data based on specified conditions.\n */\nexport interface FilterStage extends PipelineStage, WithFilter<FilterStage> {\n /**\n * @internal\n */\n readonly filterTree: Record<string, any>\n\n /**\n * @internal\n */\n readonly invalidArguments: string[]\n\n /**\n * Filters pipeline data to match items whose specified field value equals the specified value.\n *\n * The `eq()` method refines this aggregate pipeline filter to only\n * match items where the value of the specified field equals the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * Matching strings with `eq()` is case sensitive, so `\"text\"` is not equal to `\"Text\"`.\n *\n * If `field` points to a collection field of type array, `eq()` includes the item as long as at least one array element matches the specified `value`.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to compare with.\n * @requiredField value\n * @returns Refined filter.\n */\n eq(field: string, value: any): FilterStage\n\n /**\n * Filters pipeline data to match items whose specified field value does not equal the specified value.\n *\n * The `ne()` method refines this aggregate pipeline 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): FilterStage\n\n /**\n * Filters pipeline data to match items whose specified field value is greater than or equal to the specified\n * value.\n *\n * The `ge()` method refines this aggregate pipeline filter to only\n * match items where the value of the specified field is greater than or\n * equal to the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified field are ranked lowest.\n *\n * The following field types can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically,\n * so `\"abc\"` is greater than or equal to `\"ABC\"` (because of the greater than),\n * but `\"ABC\"` is not greater than or equal to `\"abc\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns Refined filter.\n */\n ge(field: string, value: string | number | Date): FilterStage\n\n /**\n * Filters pipeline data to match items whose specified field value is greater than the specified value.\n *\n * The `gt()` method refines this aggregate pipeline filter to only match\n * items where the value of the specified field is greater than the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified field are ranked lowest.\n *\n * The following field types can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"text\"` is greater than `\"Text\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns An object with the filter definition, based on the supplied parameters.\n */\n gt(field: string, value: string | number | Date): FilterStage\n\n /**\n * Filters pipeline data to match items whose specified field value is less than or equal to the specified\n * value.\n *\n * The `le()` method refines this aggregate pipeline filter to only match\n * items where the value of the specified field is less than or equal to the\n * specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified field are ranked lowest.\n *\n * The following field types can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically,\n * so `\"ABC\"` is less than or equal to `\"abc\"` (because of the less than),\n * but `\"abc\"` is not less than or equal to `\"ABC\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns Refined filter.\n */\n le(field: string, value: string | number | Date): FilterStage\n\n /**\n * Filters pipeline data to match items whose specified field value is less than the specified value.\n *\n * The `lt()` method refines this aggregate pipeline filter to only match\n * items where the value of the specified field is less than the specified `value`.\n *\n * It only matches values of the same type. For example, a number value stored\n * as a String type does not match the same number stored as a Number type.\n *\n * If a field contains a number as a String, that value is compared\n * alphabetically and not numerically. Items that do not have a value for the\n * specified field are ranked lowest.\n *\n * The following field types can be compared:\n * - Number: Compares numerically.\n * - Date: Compares JavaScript Date objects.\n * - String: Compares lexicographically, so `\"Text\"` is less than `\"text\"`.\n * - Reference: Compares by the ID of the referenced item as a String.\n * @public\n * @documentationMaturity preview\n * @param field - Field whose value is compared with `value`.\n * @requiredField field\n * @param value - Value to match.\n * @requiredField value\n * @returns An object with the filter definition, based on the supplied parameters.\n */\n lt(field: string, value: string | number | Date): FilterStage\n\n /**\n * Filters pipeline data to match items whose specified field has any value.\n *\n * The `isNotEmpty()` method refines this aggregate pipeline 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): FilterStage\n\n /**\n * Filters pipeline data to match items whose specified field does not exist or does not have any value.\n *\n * The `isEmpty()` method refines this aggregate pipeline 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): FilterStage\n\n /**\n * Filters pipeline data to match items whose specified field value starts with a specified string.\n *\n * The `startsWith()` method refines this aggregate pipeline 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): FilterStage\n\n /**\n * Filters pipeline data to match items whose specified field value ends with a specified string.\n *\n * The `endsWith()` method refines this aggregate pipeline 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): FilterStage\n\n /**\n * Filters pipeline data to match items whose specified field value contains the specified value.\n *\n * The `contains()` method refines the aggregate pipeline 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): FilterStage\n\n /**\n * Filters pipeline data to match items whose specified field value equals any of the specified `values`\n * parameters.\n *\n * The `hasSome()` method refines this aggregate pipeline 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[]): FilterStage\n\n /**\n * Overload for `hasSome()`\n * @public\n * @documentationMaturity preview\n */\n hasSome(field: string, values: Comparable[]): FilterStage\n\n /**\n * Filters pipeline data to match items whose specified field values equals all of the specified `value`\n * parameters.\n *\n * The `hasAll()` method refines this aggregate pipeline 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[]): FilterStage\n\n /**\n * Overload for `hasAll()`\n * @public\n * @documentationMaturity preview\n */\n hasAll(field: string, values: Comparable[]): FilterStage\n\n /**\n * Adds an `or` condition to the aggregate pipeline filter.\n *\n * The `or()` method adds an inclusive `or` condition to this pipeline filter. A filter\n * with an `or` returns all the items that match the filter as defined up to\n * the `or` method, the items that match the filter passed to the `or`\n * method, and the items that match both.\n *\n * The `or()` method is designed to work with 2 or more queries or filters.\n * If you use it on its own, it will return all the items in a collection.\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial filter as an `or` condition.\n * @requiredField filter\n * @returns Object representing the refined filter.\n */\n or(filter: FilterStage): FilterStage\n\n /**\n * Adds an `and` condition to the aggregate pipeline filter.\n *\n * A pipeline 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 = stages.filter()\n * .eq(\"status\", \"pending\")\n * .or(stages.filter().eq(\"status\", \"rejected\"));\n *\n * let ageFilter = stages.filter()\n * .lt(\"age\", 25)\n * .or(stages.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 `FilterStage` 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 * stages.filter().eq(\"status\", \"active\").gt(\"age\", 25);\n * ```\n *\n * @public\n * @documentationMaturity preview\n * @param filter - `FilterStage` used with an `and` condition.\n * @requiredField filter\n * @returns The compound filter.\n */\n and(filter: FilterStage): FilterStage\n\n /**\n * Adds a `not` condition to the aggregate pipeline filter.\n *\n * The `not()` method adds a `not` condition to this pipeline filter. A filter with a `not`\n * returns all the items that match the filter as defined up to the `not`\n * method, but don't match the filter passed to the `not` method.\n *\n * If the filter only contains a `not()` method, it returns all the items\n * that don't match the filter defined by the `not` method.\n *\n * @public\n * @documentationMaturity preview\n * @param filter - Filter to add to the initial filter as a `not` condition.\n * @requiredField filter\n * @returns Object representing the refined filter.\n */\n not(filter: FilterStage): FilterStage\n\n /**\n * Filters pipeline data to match items whose specified field value is within the defined range.\n *\n * The `between()` method refines this aggregate pipeline 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 * > **Note**: Items that do not have a value for the specified field are considered as the lowest comparable value and are ranked last.\n *\n * @public\n * @documentationMaturity preview\n * @param field - Field to compare with `rangeStart` and `rangeEnd`.\n * @requiredField field\n * @param rangeStart - Starting value of the range to match.\n * @requiredField rangeStart\n * @param rangeEnd - Ending value of the range to match.\n * @requiredField rangeEnd\n * @returns Refined filter.\n */\n between(\n field: string,\n rangeStart: string | number | Date,\n rangeEnd: string | number | Date\n ): FilterStage\n}\n\nexport class FilterStageImpl\n extends QueryBase<FilterStageImpl>\n implements FilterStage\n{\n constructor(origin?: {\n collectionName?: string\n filterBuilder?: PlatformizedFilterBuilder\n }) {\n super({\n collectionName: origin?.collectionName || '',\n filterBuilder: origin?.filterBuilder,\n })\n }\n\n protected copy(params: any): FilterStageImpl {\n return new FilterStageImpl({\n collectionName: this.collectionName,\n filterBuilder: params.filterBuilder || this.filterBuilder,\n })\n }\n\n get invalidArguments(): string[] {\n return []\n }\n\n toProto(): apiTypes.Stage {\n return { filter: this.filterBuilder.build() }\n }\n}\n"],"mappings":";;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAOA;AACA;AACA;AACA;AACA;AACA;;AAubO,MAAMC,eAAe,SAClBC,oBAAS,CAEnB;EACEC,WAAWA,CAACC,MAGX,EAAE;IACD,KAAK,CAAC;MACJC,cAAc,EAAE,CAAAD,MAAM,oBAANA,MAAM,CAAEC,cAAc,KAAI,EAAE;MAC5CC,aAAa,EAAEF,MAAM,oBAANA,MAAM,CAAEE;IACzB,CAAC,CAAC;EACJ;EAEUC,IAAIA,CAACC,MAAW,EAAmB;IAC3C,OAAO,IAAIP,eAAe,CAAC;MACzBI,cAAc,EAAE,IAAI,CAACA,cAAc;MACnCC,aAAa,EAAEE,MAAM,CAACF,aAAa,IAAI,IAAI,CAACA;IAC9C,CAAC,CAAC;EACJ;EAEA,IAAIG,gBAAgBA,CAAA,EAAa;IAC/B,OAAO,EAAE;EACX;EAEAC,OAAOA,CAAA,EAAmB;IACxB,OAAO;MAAEC,MAAM,EAAE,IAAI,CAACL,aAAa,CAACM,KAAK,CAAC;IAAE,CAAC;EAC/C;AACF;AAACC,OAAA,CAAAZ,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterStage.js","sourceRoot":"","sources":["../../../../src/api/stages/FilterStage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"FilterStage.js","sourceRoot":"","sources":["../../../../src/api/stages/FilterStage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAmcxC,MAAM,OAAO,eACX,SAAQ,SAA0B;IAGlC,YAAY,MAGX;QACC,KAAK,CAAC;YACJ,cAAc,EAAE,MAAM,EAAE,cAAc,IAAI,EAAE;YAC5C,aAAa,EAAE,MAAM,EAAE,aAAa;SACrC,CAAC,CAAA;IACJ,CAAC;IAES,IAAI,CAAC,MAAW;QACxB,OAAO,IAAI,eAAe,CAAC;YACzB,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,aAAa,EAAE,MAAM,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa;SAC1D,CAAC,CAAA;IACJ,CAAC;IAED,IAAI,gBAAgB;QAClB,OAAO,EAAE,CAAA;IACX,CAAC;IAED,OAAO;QACL,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,CAAA;IAC/C,CAAC;CACF"}
|
|
@@ -5,6 +5,9 @@ import { PipelineStage } from './stages';
|
|
|
5
5
|
type Comparable = string | number | Date;
|
|
6
6
|
/**
|
|
7
7
|
* @builder
|
|
8
|
+
* Filter stage for aggregate pipeline operations. This interface provides filtering capabilities
|
|
9
|
+
* specifically designed for use within aggregate pipelines, typically used with `stages.filter()`
|
|
10
|
+
* in pipeline arrays to refine data based on specified conditions.
|
|
8
11
|
*/
|
|
9
12
|
export interface FilterStage extends PipelineStage, WithFilter<FilterStage> {
|
|
10
13
|
/**
|
|
@@ -16,9 +19,9 @@ export interface FilterStage extends PipelineStage, WithFilter<FilterStage> {
|
|
|
16
19
|
*/
|
|
17
20
|
readonly invalidArguments: string[];
|
|
18
21
|
/**
|
|
19
|
-
*
|
|
22
|
+
* Filters pipeline data to match items whose specified field value equals the specified value.
|
|
20
23
|
*
|
|
21
|
-
* The `eq()` method refines this filter to only
|
|
24
|
+
* The `eq()` method refines this aggregate pipeline filter to only
|
|
22
25
|
* match items where the value of the specified field equals the specified `value`.
|
|
23
26
|
*
|
|
24
27
|
* It only matches values of the same type. For example, a number value stored
|
|
@@ -37,9 +40,9 @@ export interface FilterStage extends PipelineStage, WithFilter<FilterStage> {
|
|
|
37
40
|
*/
|
|
38
41
|
eq(field: string, value: any): FilterStage;
|
|
39
42
|
/**
|
|
40
|
-
*
|
|
43
|
+
* Filters pipeline data to match items whose specified field value does not equal the specified value.
|
|
41
44
|
*
|
|
42
|
-
* The `ne()` method refines this filter to only
|
|
45
|
+
* The `ne()` method refines this aggregate pipeline filter to only
|
|
43
46
|
* match items where the value of the specified field does not equal the specified `value`.
|
|
44
47
|
*
|
|
45
48
|
* It only matches values of the same type. For example, a number value stored
|
|
@@ -59,10 +62,10 @@ export interface FilterStage extends PipelineStage, WithFilter<FilterStage> {
|
|
|
59
62
|
*/
|
|
60
63
|
ne(field: string, value: any): FilterStage;
|
|
61
64
|
/**
|
|
62
|
-
*
|
|
65
|
+
* Filters pipeline data to match items whose specified field value is greater than or equal to the specified
|
|
63
66
|
* value.
|
|
64
67
|
*
|
|
65
|
-
* The `ge()` method refines this filter to only
|
|
68
|
+
* The `ge()` method refines this aggregate pipeline filter to only
|
|
66
69
|
* match items where the value of the specified field is greater than or
|
|
67
70
|
* equal to the specified `value`.
|
|
68
71
|
*
|
|
@@ -90,9 +93,9 @@ export interface FilterStage extends PipelineStage, WithFilter<FilterStage> {
|
|
|
90
93
|
*/
|
|
91
94
|
ge(field: string, value: string | number | Date): FilterStage;
|
|
92
95
|
/**
|
|
93
|
-
*
|
|
96
|
+
* Filters pipeline data to match items whose specified field value is greater than the specified value.
|
|
94
97
|
*
|
|
95
|
-
* The `gt()` method refines this filter to only match
|
|
98
|
+
* The `gt()` method refines this aggregate pipeline filter to only match
|
|
96
99
|
* items where the value of the specified field is greater than the specified `value`.
|
|
97
100
|
*
|
|
98
101
|
* It only matches values of the same type. For example, a number value stored
|
|
@@ -117,10 +120,10 @@ export interface FilterStage extends PipelineStage, WithFilter<FilterStage> {
|
|
|
117
120
|
*/
|
|
118
121
|
gt(field: string, value: string | number | Date): FilterStage;
|
|
119
122
|
/**
|
|
120
|
-
*
|
|
123
|
+
* Filters pipeline data to match items whose specified field value is less than or equal to the specified
|
|
121
124
|
* value.
|
|
122
125
|
*
|
|
123
|
-
* The `le()` method refines this filter to only match
|
|
126
|
+
* The `le()` method refines this aggregate pipeline filter to only match
|
|
124
127
|
* items where the value of the specified field is less than or equal to the
|
|
125
128
|
* specified `value`.
|
|
126
129
|
*
|
|
@@ -148,9 +151,9 @@ export interface FilterStage extends PipelineStage, WithFilter<FilterStage> {
|
|
|
148
151
|
*/
|
|
149
152
|
le(field: string, value: string | number | Date): FilterStage;
|
|
150
153
|
/**
|
|
151
|
-
*
|
|
154
|
+
* Filters pipeline data to match items whose specified field value is less than the specified value.
|
|
152
155
|
*
|
|
153
|
-
* The `lt()` method refines this filter to only match
|
|
156
|
+
* The `lt()` method refines this aggregate pipeline filter to only match
|
|
154
157
|
* items where the value of the specified field is less than the specified `value`.
|
|
155
158
|
*
|
|
156
159
|
* It only matches values of the same type. For example, a number value stored
|
|
@@ -175,9 +178,9 @@ export interface FilterStage extends PipelineStage, WithFilter<FilterStage> {
|
|
|
175
178
|
*/
|
|
176
179
|
lt(field: string, value: string | number | Date): FilterStage;
|
|
177
180
|
/**
|
|
178
|
-
*
|
|
181
|
+
* Filters pipeline data to match items whose specified field has any value.
|
|
179
182
|
*
|
|
180
|
-
* The `isNotEmpty()` method refines this filter to only match items where the
|
|
183
|
+
* The `isNotEmpty()` method refines this aggregate pipeline filter to only match items where the
|
|
181
184
|
* value of the specified field is not `null` or `undefined`.
|
|
182
185
|
*
|
|
183
186
|
* If the field contains any value at all for a given item, including the
|
|
@@ -190,9 +193,9 @@ export interface FilterStage extends PipelineStage, WithFilter<FilterStage> {
|
|
|
190
193
|
*/
|
|
191
194
|
isNotEmpty(field: string): FilterStage;
|
|
192
195
|
/**
|
|
193
|
-
*
|
|
196
|
+
* Filters pipeline data to match items whose specified field does not exist or does not have any value.
|
|
194
197
|
*
|
|
195
|
-
* The `isEmpty()` method refines this filter to only match items where the
|
|
198
|
+
* The `isEmpty()` method refines this aggregate pipeline filter to only match items where the
|
|
196
199
|
* value of the specified field is `null` or `undefined` or the field does
|
|
197
200
|
* not exist.
|
|
198
201
|
*
|
|
@@ -206,9 +209,9 @@ export interface FilterStage extends PipelineStage, WithFilter<FilterStage> {
|
|
|
206
209
|
*/
|
|
207
210
|
isEmpty(field: string): FilterStage;
|
|
208
211
|
/**
|
|
209
|
-
*
|
|
212
|
+
* Filters pipeline data to match items whose specified field value starts with a specified string.
|
|
210
213
|
*
|
|
211
|
-
* The `startsWith()` method refines this filter to
|
|
214
|
+
* The `startsWith()` method refines this aggregate pipeline filter to
|
|
212
215
|
* only match items where the value of the specified field starts with the
|
|
213
216
|
* defined `string`. Matching with `startsWith()` is not case sensitive, so `"TEXT"` starts
|
|
214
217
|
* with `"tex"`.
|
|
@@ -225,9 +228,9 @@ export interface FilterStage extends PipelineStage, WithFilter<FilterStage> {
|
|
|
225
228
|
*/
|
|
226
229
|
startsWith(field: string, value: string): FilterStage;
|
|
227
230
|
/**
|
|
228
|
-
*
|
|
231
|
+
* Filters pipeline data to match items whose specified field value ends with a specified string.
|
|
229
232
|
*
|
|
230
|
-
* The `endsWith()` method refines this filter to only
|
|
233
|
+
* The `endsWith()` method refines this aggregate pipeline filter to only
|
|
231
234
|
* match items where the value of the specified field ends with the specified
|
|
232
235
|
* `string`. Matching with `endsWith()` is not case sensitive, so `"TEXT"` ends
|
|
233
236
|
* with `"ext"`.
|
|
@@ -244,9 +247,9 @@ export interface FilterStage extends PipelineStage, WithFilter<FilterStage> {
|
|
|
244
247
|
*/
|
|
245
248
|
endsWith(field: string, value: string): FilterStage;
|
|
246
249
|
/**
|
|
247
|
-
*
|
|
250
|
+
* Filters pipeline data to match items whose specified field value contains the specified value.
|
|
248
251
|
*
|
|
249
|
-
* 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`.
|
|
252
|
+
* The `contains()` method refines the aggregate pipeline 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`.
|
|
250
253
|
*
|
|
251
254
|
* 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.
|
|
252
255
|
* @public
|
|
@@ -259,10 +262,10 @@ export interface FilterStage extends PipelineStage, WithFilter<FilterStage> {
|
|
|
259
262
|
*/
|
|
260
263
|
contains(field: string, value: string): FilterStage;
|
|
261
264
|
/**
|
|
262
|
-
*
|
|
265
|
+
* Filters pipeline data to match items whose specified field value equals any of the specified `values`
|
|
263
266
|
* parameters.
|
|
264
267
|
*
|
|
265
|
-
* The `hasSome()` method refines this filter to
|
|
268
|
+
* The `hasSome()` method refines this aggregate pipeline filter to
|
|
266
269
|
* only match items where the value of the specified field equals any of
|
|
267
270
|
* the specified values.
|
|
268
271
|
*
|
|
@@ -293,10 +296,10 @@ export interface FilterStage extends PipelineStage, WithFilter<FilterStage> {
|
|
|
293
296
|
*/
|
|
294
297
|
hasSome(field: string, values: Comparable[]): FilterStage;
|
|
295
298
|
/**
|
|
296
|
-
*
|
|
299
|
+
* Filters pipeline data to match items whose specified field values equals all of the specified `value`
|
|
297
300
|
* parameters.
|
|
298
301
|
*
|
|
299
|
-
* The `hasAll()` method refines this filter to
|
|
302
|
+
* The `hasAll()` method refines this aggregate pipeline filter to
|
|
300
303
|
* only match items where the value of the specified field equals all of
|
|
301
304
|
* the specified values.
|
|
302
305
|
*
|
|
@@ -324,9 +327,9 @@ export interface FilterStage extends PipelineStage, WithFilter<FilterStage> {
|
|
|
324
327
|
*/
|
|
325
328
|
hasAll(field: string, values: Comparable[]): FilterStage;
|
|
326
329
|
/**
|
|
327
|
-
* Adds an `or` condition to the filter.
|
|
330
|
+
* Adds an `or` condition to the aggregate pipeline filter.
|
|
328
331
|
*
|
|
329
|
-
* The `or()` method adds an inclusive `or` condition to this filter. A filter
|
|
332
|
+
* The `or()` method adds an inclusive `or` condition to this pipeline filter. A filter
|
|
330
333
|
* with an `or` returns all the items that match the filter as defined up to
|
|
331
334
|
* the `or` method, the items that match the filter passed to the `or`
|
|
332
335
|
* method, and the items that match both.
|
|
@@ -341,22 +344,22 @@ export interface FilterStage extends PipelineStage, WithFilter<FilterStage> {
|
|
|
341
344
|
*/
|
|
342
345
|
or(filter: FilterStage): FilterStage;
|
|
343
346
|
/**
|
|
344
|
-
* Adds an `and` condition to the filter.
|
|
347
|
+
* Adds an `and` condition to the aggregate pipeline filter.
|
|
345
348
|
*
|
|
346
|
-
* A filter with an `and` condition returns all items that meet the conditions defined on both sides of the condition.
|
|
349
|
+
* A pipeline filter with an `and` condition returns all items that meet the conditions defined on both sides of the condition.
|
|
347
350
|
*
|
|
348
351
|
* Use the `and()` method when performing compound queries. For example, the final filter in this set of
|
|
349
352
|
* queries returns results where status is either pending or rejected **and** age is either less than 25 or greater
|
|
350
353
|
* than 65.
|
|
351
354
|
*
|
|
352
355
|
* ```js
|
|
353
|
-
* let statusFilter =
|
|
356
|
+
* let statusFilter = stages.filter()
|
|
354
357
|
* .eq("status", "pending")
|
|
355
|
-
* .or(
|
|
358
|
+
* .or(stages.filter().eq("status", "rejected"));
|
|
356
359
|
*
|
|
357
|
-
* let ageFilter =
|
|
360
|
+
* let ageFilter = stages.filter()
|
|
358
361
|
* .lt("age", 25)
|
|
359
|
-
* .or(
|
|
362
|
+
* .or(stages.filter().gt("age", 65));
|
|
360
363
|
*
|
|
361
364
|
* let statusAndAgeFilter = statusFilter.and(ageFilter);
|
|
362
365
|
* ```
|
|
@@ -366,7 +369,7 @@ export interface FilterStage extends PipelineStage, WithFilter<FilterStage> {
|
|
|
366
369
|
* > - When chaining multiple `FilterStage` 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:
|
|
367
370
|
*
|
|
368
371
|
* ```js
|
|
369
|
-
*
|
|
372
|
+
* stages.filter().eq("status", "active").gt("age", 25);
|
|
370
373
|
* ```
|
|
371
374
|
*
|
|
372
375
|
* @public
|
|
@@ -377,9 +380,9 @@ export interface FilterStage extends PipelineStage, WithFilter<FilterStage> {
|
|
|
377
380
|
*/
|
|
378
381
|
and(filter: FilterStage): FilterStage;
|
|
379
382
|
/**
|
|
380
|
-
* Adds a `not` condition to the filter.
|
|
383
|
+
* Adds a `not` condition to the aggregate pipeline filter.
|
|
381
384
|
*
|
|
382
|
-
* The `not()` method adds a `not` condition to this filter. A filter with a `not`
|
|
385
|
+
* The `not()` method adds a `not` condition to this pipeline filter. A filter with a `not`
|
|
383
386
|
* returns all the items that match the filter as defined up to the `not`
|
|
384
387
|
* method, but don't match the filter passed to the `not` method.
|
|
385
388
|
*
|
|
@@ -394,9 +397,9 @@ export interface FilterStage extends PipelineStage, WithFilter<FilterStage> {
|
|
|
394
397
|
*/
|
|
395
398
|
not(filter: FilterStage): FilterStage;
|
|
396
399
|
/**
|
|
397
|
-
*
|
|
400
|
+
* Filters pipeline data to match items whose specified field value is within the defined range.
|
|
398
401
|
*
|
|
399
|
-
* 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).
|
|
402
|
+
* The `between()` method refines this aggregate pipeline 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).
|
|
400
403
|
*
|
|
401
404
|
* The following types can be compared:
|
|
402
405
|
* - Number: Compared numerically.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterStage.d.ts","sourceRoot":"","sources":["../../../../src/api/stages/FilterStage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,yBAAyB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACpE,OAAO,KAAK,QAAQ,MAAM,6BAA6B,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,KAAK,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;AAExC
|
|
1
|
+
{"version":3,"file":"FilterStage.d.ts","sourceRoot":"","sources":["../../../../src/api/stages/FilterStage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,yBAAyB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACpE,OAAO,KAAK,QAAQ,MAAM,6BAA6B,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,KAAK,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;AAExC;;;;;GAKG;AACH,MAAM,WAAW,WAAY,SAAQ,aAAa,EAAE,UAAU,CAAC,WAAW,CAAC;IACzE;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAExC;;OAEG;IACH,QAAQ,CAAC,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAEnC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,WAAW,CAAA;IAE1C;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,WAAW,CAAA;IAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,WAAW,CAAA;IAE7D;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,WAAW,CAAA;IAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,WAAW,CAAA;IAE7D;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,WAAW,CAAA;IAE7D;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAAA;IAEtC;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAAA;IAEnC;;;;;;;;;;;;;;;;;OAiBG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,CAAA;IAErD;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,CAAA;IAEnD;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,CAAA;IAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,UAAU,EAAE,GAAG,WAAW,CAAA;IAE5D;;;;OAIG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,WAAW,CAAA;IAEzD;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,UAAU,EAAE,GAAG,WAAW,CAAA;IAE3D;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,WAAW,CAAA;IAExD;;;;;;;;;;;;;;;OAeG;IACH,EAAE,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAAA;IAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;IACH,GAAG,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAAA;IAErC;;;;;;;;;;;;;;;OAeG;IACH,GAAG,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAAA;IAErC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,OAAO,CACL,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,EAClC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAC/B,WAAW,CAAA;CACf;AAED,qBAAa,eACX,SAAQ,SAAS,CAAC,eAAe,CACjC,YAAW,WAAW;gBAEV,MAAM,CAAC,EAAE;QACnB,cAAc,CAAC,EAAE,MAAM,CAAA;QACvB,aAAa,CAAC,EAAE,yBAAyB,CAAA;KAC1C;IAOD,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,eAAe;IAO5C,IAAI,gBAAgB,IAAI,MAAM,EAAE,CAE/B;IAED,OAAO,IAAI,QAAQ,CAAC,KAAK;CAG1B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/wix-data-items-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.188",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Rimvydas Gimbutas",
|
|
@@ -32,16 +32,16 @@
|
|
|
32
32
|
"@babel/runtime": "^7.27.6",
|
|
33
33
|
"@types/kind-of": "^6.0.3",
|
|
34
34
|
"@types/safe-json-stringify": "^1.1.5",
|
|
35
|
-
"@wix/filter-builder": "1.0.
|
|
35
|
+
"@wix/filter-builder": "1.0.171",
|
|
36
36
|
"kind-of": "^6.0.3",
|
|
37
37
|
"safe-json-stringify": "^1.2.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/jest": "^29.5.14",
|
|
41
41
|
"@types/node": "^18.19.118",
|
|
42
|
-
"@wix/eslint-config-yoshi": "^6.
|
|
43
|
-
"@wix/jest-yoshi-preset": "^6.
|
|
44
|
-
"@wix/yoshi-flow-library": "^6.
|
|
42
|
+
"@wix/eslint-config-yoshi": "^6.151.0",
|
|
43
|
+
"@wix/jest-yoshi-preset": "^6.151.0",
|
|
44
|
+
"@wix/yoshi-flow-library": "^6.151.0",
|
|
45
45
|
"chai": "~3.5.0",
|
|
46
46
|
"ts-jest": "^26.5.6",
|
|
47
47
|
"typescript": "~4.9.5"
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"wallaby": {
|
|
86
86
|
"autoDetect": true
|
|
87
87
|
},
|
|
88
|
-
"falconPackageHash": "
|
|
88
|
+
"falconPackageHash": "ba6b8fe4a43686d3cc23e30c5f1bba7555f9447388f7e067657e40fb"
|
|
89
89
|
}
|