aws-service-stack 0.18.397 → 0.18.398
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.
|
@@ -45,12 +45,23 @@ export declare enum BoolQueryTypeOS {
|
|
|
45
45
|
nin = "nin",
|
|
46
46
|
gte = "gte",
|
|
47
47
|
lte = "lte",
|
|
48
|
+
gt = "gt",
|
|
49
|
+
lt = "lt",
|
|
48
50
|
exists = "exists",
|
|
49
|
-
regex = "regex"
|
|
51
|
+
regex = "regex",
|
|
52
|
+
prefix = "prefix",
|
|
53
|
+
not_prefix = "not_prefix",
|
|
54
|
+
contains = "contains",
|
|
55
|
+
not_contains = "not_contains",
|
|
56
|
+
wildcard = "wildcard",
|
|
57
|
+
not_wildcard = "not_wildcard",
|
|
58
|
+
fuzzy = "fuzzy"
|
|
50
59
|
}
|
|
51
60
|
export declare enum RangeTypeOS {
|
|
52
61
|
lte = "lte",
|
|
53
|
-
gte = "gte"
|
|
62
|
+
gte = "gte",
|
|
63
|
+
lt = "lt",
|
|
64
|
+
gt = "gt"
|
|
54
65
|
}
|
|
55
66
|
export declare enum SearchOperatorOS {
|
|
56
67
|
AND = "and",
|
|
@@ -9,13 +9,24 @@ var BoolQueryTypeOS;
|
|
|
9
9
|
BoolQueryTypeOS["nin"] = "nin";
|
|
10
10
|
BoolQueryTypeOS["gte"] = "gte";
|
|
11
11
|
BoolQueryTypeOS["lte"] = "lte";
|
|
12
|
+
BoolQueryTypeOS["gt"] = "gt";
|
|
13
|
+
BoolQueryTypeOS["lt"] = "lt";
|
|
12
14
|
BoolQueryTypeOS["exists"] = "exists";
|
|
13
15
|
BoolQueryTypeOS["regex"] = "regex";
|
|
16
|
+
BoolQueryTypeOS["prefix"] = "prefix";
|
|
17
|
+
BoolQueryTypeOS["not_prefix"] = "not_prefix";
|
|
18
|
+
BoolQueryTypeOS["contains"] = "contains";
|
|
19
|
+
BoolQueryTypeOS["not_contains"] = "not_contains";
|
|
20
|
+
BoolQueryTypeOS["wildcard"] = "wildcard";
|
|
21
|
+
BoolQueryTypeOS["not_wildcard"] = "not_wildcard";
|
|
22
|
+
BoolQueryTypeOS["fuzzy"] = "fuzzy";
|
|
14
23
|
})(BoolQueryTypeOS || (exports.BoolQueryTypeOS = BoolQueryTypeOS = {}));
|
|
15
24
|
var RangeTypeOS;
|
|
16
25
|
(function (RangeTypeOS) {
|
|
17
26
|
RangeTypeOS["lte"] = "lte";
|
|
18
27
|
RangeTypeOS["gte"] = "gte";
|
|
28
|
+
RangeTypeOS["lt"] = "lt";
|
|
29
|
+
RangeTypeOS["gt"] = "gt";
|
|
19
30
|
})(RangeTypeOS || (exports.RangeTypeOS = RangeTypeOS = {}));
|
|
20
31
|
var SearchOperatorOS;
|
|
21
32
|
(function (SearchOperatorOS) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.model.js","sourceRoot":"","sources":["../../src/model/filter.model.ts"],"names":[],"mappings":";;;AA8CA,IAAY,
|
|
1
|
+
{"version":3,"file":"filter.model.js","sourceRoot":"","sources":["../../src/model/filter.model.ts"],"names":[],"mappings":";;;AA8CA,IAAY,eAkBX;AAlBD,WAAY,eAAe;IACzB,4BAAS,CAAA;IACT,4BAAS,CAAA;IACT,4BAAS,CAAA;IACT,8BAAW,CAAA;IACX,8BAAW,CAAA;IACX,8BAAW,CAAA;IACX,4BAAS,CAAA;IACT,4BAAS,CAAA;IACT,oCAAiB,CAAA;IACjB,kCAAe,CAAA;IACf,oCAAiB,CAAA;IACjB,4CAAyB,CAAA;IACzB,wCAAqB,CAAA;IACrB,gDAA6B,CAAA;IAC7B,wCAAqB,CAAA;IACrB,gDAA6B,CAAA;IAC7B,kCAAe,CAAA;AACjB,CAAC,EAlBW,eAAe,+BAAf,eAAe,QAkB1B;AAED,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,0BAAW,CAAA;IACX,0BAAW,CAAA;IACX,wBAAS,CAAA;IACT,wBAAS,CAAA;AACX,CAAC,EALW,WAAW,2BAAX,WAAW,QAKtB;AAED,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,+BAAW,CAAA;IACX,6BAAS,CAAA;AACX,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B;AAED,IAAY,SAOX;AAPD,WAAY,SAAS;IACnB,4BAAe,CAAA;IACf,wBAAW,CAAA;IACX,wBAAW,CAAA;IACX,wBAAW,CAAA;IACX,wBAAW,CAAA;IACX,0BAAa,CAAA;AACf,CAAC,EAPW,SAAS,yBAAT,SAAS,QAOpB","sourcesContent":["import { SortOrder } from \"@chinggis/core\";\n\nexport interface Filter extends Record<string, any> {\n page?: number; // The page number for pagination\n size?: number; // The size of items per page\n sortBy?: string; // The field to sort by\n sort?: SortOrder; // Sorting order, either ascending or descending\n searchBy?: string[]; // The field to search in\n searchKeyword?: string; // The keyword to search for\n rangeFilters?: RangeFilter[]; // The field to apply range filtering on\n lastKey?: string;\n indexName?: string;\n indexValue?: string;\n indexSortName?: string;\n indexSortValue?: string;\n fieldsInclude?: string[];\n fieldsExclude?: string[];\n urlRaw?: string;\n}\n\nexport type RangeFilter = {\n fieldName: string;\n minValue?: number | Date;\n maxValue?: number | Date;\n minExclude?: boolean;\n maxExclude?: boolean;\n};\n\nexport type NumberRange = {\n gte?: number;\n lte?: number;\n};\n\nexport type DateRange = {\n gte?: string;\n lte?: string;\n};\n\nexport interface BoolQueryOS {\n must: Array<any>;\n must_not: Array<any>;\n filter: Array<any>;\n should: Array<any>;\n minimum_should_match?: number;\n}\n\nexport enum BoolQueryTypeOS {\n eq = \"eq\",\n ne = \"ne\",\n in = \"in\",\n nin = \"nin\",\n gte = \"gte\",\n lte = \"lte\",\n gt = \"gt\",\n lt = \"lt\",\n exists = \"exists\",\n regex = \"regex\",\n prefix = \"prefix\",\n not_prefix = \"not_prefix\",\n contains = \"contains\",\n not_contains = \"not_contains\",\n wildcard = \"wildcard\",\n not_wildcard = \"not_wildcard\",\n fuzzy = \"fuzzy\",\n}\n\nexport enum RangeTypeOS {\n lte = \"lte\",\n gte = \"gte\",\n lt = \"lt\",\n gt = \"gt\",\n}\n\nexport enum SearchOperatorOS {\n AND = \"and\",\n OR = \"or\",\n}\n\nexport enum AggTypeOS {\n TERMS = \"terms\",\n SUM = \"sum\",\n AVG = \"avg\",\n MAX = \"max\",\n MIN = \"min\",\n TREE = \"tree\",\n}\n"]}
|
|
@@ -10,8 +10,17 @@ exports.boolQueryMap = {
|
|
|
10
10
|
nin: (field, value) => ({ query: buildTermsFilter(field, value), negation: true }),
|
|
11
11
|
gte: (field, value, existing) => buildRangeFilter(field, value, types_1.RangeTypeOS.gte, existing),
|
|
12
12
|
lte: (field, value, existing) => buildRangeFilter(field, value, types_1.RangeTypeOS.lte, existing),
|
|
13
|
+
gt: (field, value, existing) => buildRangeFilter(field, value, types_1.RangeTypeOS.gt, existing),
|
|
14
|
+
lt: (field, value, existing) => buildRangeFilter(field, value, types_1.RangeTypeOS.lt, existing),
|
|
13
15
|
exists: (field, value) => buildExistsFilter(field, value),
|
|
14
16
|
regex: (field, value) => buildRegexpFilter(field, value),
|
|
17
|
+
prefix: (field, value) => buildPrefixFilter(field, value),
|
|
18
|
+
not_prefix: (field, value) => ({ query: buildPrefixFilter(field, value), negation: true }),
|
|
19
|
+
contains: (field, value) => buildContainsFilter(field, value),
|
|
20
|
+
not_contains: (field, value) => ({ query: buildContainsFilter(field, value), negation: true }),
|
|
21
|
+
wildcard: (field, value) => buildWildcardFilter(field, value),
|
|
22
|
+
not_wildcard: (field, value) => ({ query: buildWildcardFilter(field, value), negation: true }),
|
|
23
|
+
fuzzy: (field, value) => buildFuzzyFilter(field, value),
|
|
15
24
|
};
|
|
16
25
|
// ---------------- Operator Functions ----------------
|
|
17
26
|
function buildTermFilter(field, value) {
|
|
@@ -37,4 +46,20 @@ function buildExistsFilter(field, value) {
|
|
|
37
46
|
function buildRegexpFilter(field, value) {
|
|
38
47
|
return { regexp: { [field]: value } };
|
|
39
48
|
}
|
|
49
|
+
// Prefix: startsWith — used for tree path hierarchy (categoryPaths__prefix)
|
|
50
|
+
function buildPrefixFilter(field, value) {
|
|
51
|
+
return { prefix: { [`${field}.keyword`]: value } };
|
|
52
|
+
}
|
|
53
|
+
// Contains: substring match anywhere in the value (categoryPaths__contains)
|
|
54
|
+
function buildContainsFilter(field, value) {
|
|
55
|
+
return { wildcard: { [`${field}.keyword`]: { value: `*${value}*`, case_insensitive: true } } };
|
|
56
|
+
}
|
|
57
|
+
// Wildcard: user-supplied pattern with * and ? (field__wildcard: "ном*уран?охиол")
|
|
58
|
+
function buildWildcardFilter(field, value) {
|
|
59
|
+
return { wildcard: { [`${field}.keyword`]: { value, case_insensitive: true } } };
|
|
60
|
+
}
|
|
61
|
+
// Fuzzy: approximate/typo-tolerant match (field__fuzzy: "ураnзохиол")
|
|
62
|
+
function buildFuzzyFilter(field, value) {
|
|
63
|
+
return { fuzzy: { [field]: { value, fuzziness: "AUTO", prefix_length: 1 } } };
|
|
64
|
+
}
|
|
40
65
|
//# sourceMappingURL=opensearch.parser.query.map.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opensearch.parser.query.map.js","sourceRoot":"","sources":["../../../src/utils/opensearch/opensearch.parser.query.map.ts"],"names":[],"mappings":";;;AAAA,2CAA+D;AAE/D,mDAAmD;AACtC,QAAA,YAAY,GAGrB;IACF,EAAE,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC;IACnD,EAAE,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAChF,EAAE,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC;IACpD,GAAG,EAAE,CAAC,KAAK,EAAE,KA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chinggis/types\";\n\n// ---------------- Bool Query Map ----------------\nexport const boolQueryMap: Record<\n BoolQueryTypeOS,\n (field: string, value: string, existing?: Record<string, any>) => { query: any; negation?: boolean } | any\n> = {\n eq: (field, value) => buildTermFilter(field, value),\n ne: (field, value) => ({ query: buildTermFilter(field, value), negation: true }),\n in: (field, value) => buildTermsFilter(field, value),\n nin: (field, value) => ({ query: buildTermsFilter(field, value), negation: true }),\n gte: (field, value, existing) => buildRangeFilter(field, value, RangeTypeOS.gte, existing),\n lte: (field, value, existing) => buildRangeFilter(field, value, RangeTypeOS.lte, existing),\n gt: (field, value, existing) => buildRangeFilter(field, value, RangeTypeOS.gt, existing),\n lt: (field, value, existing) => buildRangeFilter(field, value, RangeTypeOS.lt, existing),\n exists: (field, value) => buildExistsFilter(field, value),\n regex: (field, value) => buildRegexpFilter(field, value),\n prefix: (field, value) => buildPrefixFilter(field, value),\n not_prefix: (field, value) => ({ query: buildPrefixFilter(field, value), negation: true }),\n contains: (field, value) => buildContainsFilter(field, value),\n not_contains: (field, value) => ({ query: buildContainsFilter(field, value), negation: true }),\n wildcard: (field, value) => buildWildcardFilter(field, value),\n not_wildcard: (field, value) => ({ query: buildWildcardFilter(field, value), negation: true }),\n fuzzy: (field, value) => buildFuzzyFilter(field, value),\n};\n\n// ---------------- Operator Functions ----------------\nfunction buildTermFilter(field: string, value: string) {\n return { term: { [field]: value } };\n}\n\nfunction buildTermsFilter(field: string, value: string) {\n return { terms: { [field]: value.split(\",\") } };\n}\n\nfunction buildRangeFilter(field: string, value: string, operator: RangeTypeOS, existing?: Record<string, any>) {\n const val = isNaN(Number(value)) ? value : Number(value);\n return {\n range: {\n [field]: {\n ...(existing?.[field] || {}),\n [operator]: val,\n },\n },\n };\n}\n\nfunction buildExistsFilter(field: string, value: string | boolean) {\n return { query: { exists: { field } }, negation: value === \"false\" || value === false };\n}\n\nfunction buildRegexpFilter(field: string, value: string) {\n return { regexp: { [field]: value } };\n}\n\n// Prefix: startsWith — used for tree path hierarchy (categoryPaths__prefix)\nfunction buildPrefixFilter(field: string, value: string) {\n return { prefix: { [`${field}.keyword`]: value } };\n}\n\n// Contains: substring match anywhere in the value (categoryPaths__contains)\nfunction buildContainsFilter(field: string, value: string) {\n return { wildcard: { [`${field}.keyword`]: { value: `*${value}*`, case_insensitive: true } } };\n}\n\n// Wildcard: user-supplied pattern with * and ? (field__wildcard: \"ном*уран?охиол\")\nfunction buildWildcardFilter(field: string, value: string) {\n return { wildcard: { [`${field}.keyword`]: { value, case_insensitive: true } } };\n}\n\n// Fuzzy: approximate/typo-tolerant match (field__fuzzy: \"ураnзохиол\")\nfunction buildFuzzyFilter(field: string, value: string) {\n return { fuzzy: { [field]: { value, fuzziness: \"AUTO\", prefix_length: 1 } } };\n}\n"]}
|