@webiny/api-elasticsearch 0.0.0-mt-2 → 0.0.0-unstable.13771d80a8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client.js +17 -9
- package/client.js.map +1 -0
- package/compression.js.map +1 -0
- package/cursors.d.ts +3 -2
- package/cursors.js +7 -1
- package/cursors.js.map +1 -0
- package/index.d.ts +14 -2
- package/index.js +169 -4
- package/index.js.map +1 -0
- package/indexConfiguration/base.d.ts +6 -0
- package/indexConfiguration/base.js +45 -0
- package/indexConfiguration/base.js.map +1 -0
- package/indexConfiguration/common.d.ts +9 -0
- package/indexConfiguration/common.js +45 -0
- package/indexConfiguration/common.js.map +1 -0
- package/indexConfiguration/index.d.ts +3 -0
- package/indexConfiguration/index.js +44 -0
- package/indexConfiguration/index.js.map +1 -0
- package/indexConfiguration/japanese.d.ts +6 -0
- package/indexConfiguration/japanese.js +124 -0
- package/indexConfiguration/japanese.js.map +1 -0
- package/indices.d.ts +9 -0
- package/indices.js +35 -0
- package/indices.js.map +1 -0
- package/limit.js.map +1 -0
- package/normalize.js +11 -8
- package/normalize.js.map +1 -0
- package/operators.d.ts +5 -14
- package/operators.js +41 -27
- package/operators.js.map +1 -0
- package/package.json +14 -14
- package/plugins/GzipCompression.d.ts +5 -0
- package/plugins/GzipCompression.js +13 -2
- package/plugins/GzipCompression.js.map +1 -0
- package/plugins/definition/CompressionPlugin.d.ts +1 -1
- package/plugins/definition/CompressionPlugin.js +1 -1
- package/plugins/definition/CompressionPlugin.js.map +1 -0
- package/plugins/definition/ElasticsearchBodyModifierPlugin.js +1 -1
- package/plugins/definition/ElasticsearchBodyModifierPlugin.js.map +1 -0
- package/plugins/definition/ElasticsearchFieldPlugin.d.ts +8 -14
- package/plugins/definition/ElasticsearchFieldPlugin.js +25 -49
- package/plugins/definition/ElasticsearchFieldPlugin.js.map +1 -0
- package/plugins/definition/ElasticsearchIndexPlugin.d.ts +18 -0
- package/plugins/definition/ElasticsearchIndexPlugin.js +46 -0
- package/plugins/definition/ElasticsearchIndexPlugin.js.map +1 -0
- package/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.d.ts +5 -1
- package/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.js +11 -2
- package/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.js.map +1 -0
- package/plugins/definition/ElasticsearchQueryModifierPlugin.js +1 -1
- package/plugins/definition/ElasticsearchQueryModifierPlugin.js.map +1 -0
- package/plugins/definition/ElasticsearchSortModifierPlugin.js +1 -1
- package/plugins/definition/ElasticsearchSortModifierPlugin.js.map +1 -0
- package/plugins/definition/index.d.ts +7 -0
- package/plugins/definition/index.js +96 -0
- package/plugins/definition/index.js.map +1 -0
- package/plugins/index.d.ts +2 -0
- package/plugins/index.js +31 -0
- package/plugins/index.js.map +1 -0
- package/plugins/operator/andIn.js +2 -2
- package/plugins/operator/andIn.js.map +1 -0
- package/plugins/operator/between.js +6 -5
- package/plugins/operator/between.js.map +1 -0
- package/plugins/operator/contains.js +2 -2
- package/plugins/operator/contains.js.map +1 -0
- package/plugins/operator/equal.js +34 -5
- package/plugins/operator/equal.js.map +1 -0
- package/plugins/operator/gt.js +2 -2
- package/plugins/operator/gt.js.map +1 -0
- package/plugins/operator/gte.js +2 -2
- package/plugins/operator/gte.js.map +1 -0
- package/plugins/operator/in.js +7 -13
- package/plugins/operator/in.js.map +1 -0
- package/plugins/operator/index.d.ts +3 -0
- package/plugins/operator/index.js +39 -0
- package/plugins/operator/index.js.map +1 -0
- package/plugins/operator/japanese/contains.d.ts +8 -0
- package/plugins/operator/japanese/contains.js +58 -0
- package/plugins/operator/japanese/contains.js.map +1 -0
- package/plugins/operator/lt.js +2 -2
- package/plugins/operator/lt.js.map +1 -0
- package/plugins/operator/lte.js +2 -2
- package/plugins/operator/lte.js.map +1 -0
- package/plugins/operator/not.js +25 -3
- package/plugins/operator/not.js.map +1 -0
- package/plugins/operator/notBetween.js +5 -4
- package/plugins/operator/notBetween.js.map +1 -0
- package/plugins/operator/notContains.js +2 -2
- package/plugins/operator/notContains.js.map +1 -0
- package/plugins/operator/notIn.js +4 -3
- package/plugins/operator/notIn.js.map +1 -0
- package/plugins/operator/notStartsWith.d.ts +7 -0
- package/plugins/operator/notStartsWith.js +38 -0
- package/plugins/operator/notStartsWith.js.map +1 -0
- package/plugins/operator/startsWith.d.ts +7 -0
- package/plugins/operator/startsWith.js +38 -0
- package/plugins/operator/startsWith.js.map +1 -0
- package/sort.d.ts +4 -3
- package/sort.js +13 -3
- package/sort.js.map +1 -0
- package/types.d.ts +163 -4
- package/types.js +12 -0
- package/types.js.map +1 -0
- package/where.d.ts +2 -2
- package/where.js +3 -2
- package/where.js.map +1 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.ElasticsearchIndexPlugin = void 0;
|
|
9
|
+
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
|
+
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
|
|
14
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
15
|
+
|
|
16
|
+
var _plugins = require("@webiny/plugins");
|
|
17
|
+
|
|
18
|
+
class ElasticsearchIndexPlugin extends _plugins.Plugin {
|
|
19
|
+
constructor(params) {
|
|
20
|
+
super();
|
|
21
|
+
(0, _defineProperty2.default)(this, "body", void 0);
|
|
22
|
+
(0, _defineProperty2.default)(this, "locales", void 0);
|
|
23
|
+
const {
|
|
24
|
+
locales,
|
|
25
|
+
body
|
|
26
|
+
} = params;
|
|
27
|
+
this.body = (0, _objectSpread2.default)({}, body);
|
|
28
|
+
this.locales = locales ? locales.map(locale => locale.toLowerCase()) : undefined;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
canUse(locale) {
|
|
32
|
+
if (!this.locales) {
|
|
33
|
+
return true;
|
|
34
|
+
} else if (this.locales.length === 0) {
|
|
35
|
+
throw new _error.default("Cannot have Elasticsearch Index Template plugin with no locales defined.", "LOCALES_ERROR", {
|
|
36
|
+
body: this.body,
|
|
37
|
+
locales: this.locales
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return this.locales.includes(locale.toLowerCase());
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
exports.ElasticsearchIndexPlugin = ElasticsearchIndexPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ElasticsearchIndexPlugin","Plugin","constructor","params","locales","body","map","locale","toLowerCase","undefined","canUse","length","WebinyError","includes"],"sources":["ElasticsearchIndexPlugin.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { Plugin } from \"@webiny/plugins\";\nimport { ElasticsearchIndexRequestBody } from \"~/types\";\n\nexport interface ElasticsearchIndexPluginParams {\n /**\n * For which locales are we applying this plugin.\n * Options:\n * - locale codes to target specific locale\n * - null for all\n */\n locales?: string[];\n body: ElasticsearchIndexRequestBody;\n}\n\nexport abstract class ElasticsearchIndexPlugin extends Plugin {\n public readonly body: ElasticsearchIndexRequestBody;\n private readonly locales: string[] | undefined;\n\n public constructor(params: ElasticsearchIndexPluginParams) {\n super();\n const { locales, body } = params;\n this.body = {\n ...body\n };\n this.locales = locales ? locales.map(locale => locale.toLowerCase()) : undefined;\n }\n\n public canUse(locale: string): boolean {\n if (!this.locales) {\n return true;\n } else if (this.locales.length === 0) {\n throw new WebinyError(\n \"Cannot have Elasticsearch Index Template plugin with no locales defined.\",\n \"LOCALES_ERROR\",\n {\n body: this.body,\n locales: this.locales\n }\n );\n }\n return this.locales.includes(locale.toLowerCase());\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AAcO,MAAeA,wBAAf,SAAgDC,eAAhD,CAAuD;EAInDC,WAAW,CAACC,MAAD,EAAyC;IACvD;IADuD;IAAA;IAEvD,MAAM;MAAEC,OAAF;MAAWC;IAAX,IAAoBF,MAA1B;IACA,KAAKE,IAAL,mCACOA,IADP;IAGA,KAAKD,OAAL,GAAeA,OAAO,GAAGA,OAAO,CAACE,GAAR,CAAYC,MAAM,IAAIA,MAAM,CAACC,WAAP,EAAtB,CAAH,GAAiDC,SAAvE;EACH;;EAEMC,MAAM,CAACH,MAAD,EAA0B;IACnC,IAAI,CAAC,KAAKH,OAAV,EAAmB;MACf,OAAO,IAAP;IACH,CAFD,MAEO,IAAI,KAAKA,OAAL,CAAaO,MAAb,KAAwB,CAA5B,EAA+B;MAClC,MAAM,IAAIC,cAAJ,CACF,0EADE,EAEF,eAFE,EAGF;QACIP,IAAI,EAAE,KAAKA,IADf;QAEID,OAAO,EAAE,KAAKA;MAFlB,CAHE,CAAN;IAQH;;IACD,OAAO,KAAKA,OAAL,CAAaS,QAAb,CAAsBN,MAAM,CAACC,WAAP,EAAtB,CAAP;EACH;;AA3ByD"}
|
|
@@ -4,7 +4,11 @@ import { ElasticsearchBoolQueryConfig, ElasticsearchQueryBuilderArgsPlugin } fro
|
|
|
4
4
|
* Built-in operators name ends with .default because user can override the operator, just write a name without the .default keyword.
|
|
5
5
|
*/
|
|
6
6
|
export declare abstract class ElasticsearchQueryBuilderOperatorPlugin extends Plugin {
|
|
7
|
-
static readonly type
|
|
7
|
+
static readonly type: string;
|
|
8
|
+
/**
|
|
9
|
+
* Check if current locale is supported by this plugin.
|
|
10
|
+
*/
|
|
11
|
+
isLocaleSupported(_: string): boolean;
|
|
8
12
|
abstract getOperator(): string;
|
|
9
13
|
abstract apply(query: ElasticsearchBoolQueryConfig, params: ElasticsearchQueryBuilderArgsPlugin): void;
|
|
10
14
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
@@ -14,7 +14,16 @@ var _plugins = require("@webiny/plugins");
|
|
|
14
14
|
/**
|
|
15
15
|
* Built-in operators name ends with .default because user can override the operator, just write a name without the .default keyword.
|
|
16
16
|
*/
|
|
17
|
-
class ElasticsearchQueryBuilderOperatorPlugin extends _plugins.Plugin {
|
|
17
|
+
class ElasticsearchQueryBuilderOperatorPlugin extends _plugins.Plugin {
|
|
18
|
+
/**
|
|
19
|
+
* Check if current locale is supported by this plugin.
|
|
20
|
+
*/
|
|
21
|
+
// eslint-disable-next-line
|
|
22
|
+
isLocaleSupported(_) {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}
|
|
18
27
|
|
|
19
28
|
exports.ElasticsearchQueryBuilderOperatorPlugin = ElasticsearchQueryBuilderOperatorPlugin;
|
|
20
29
|
(0, _defineProperty2.default)(ElasticsearchQueryBuilderOperatorPlugin, "type", "elasticsearch.queryBuilder.operator");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ElasticsearchQueryBuilderOperatorPlugin","Plugin","isLocaleSupported","_"],"sources":["ElasticsearchQueryBuilderOperatorPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { ElasticsearchBoolQueryConfig, ElasticsearchQueryBuilderArgsPlugin } from \"~/types\";\n\n/**\n * Built-in operators name ends with .default because user can override the operator, just write a name without the .default keyword.\n */\nexport abstract class ElasticsearchQueryBuilderOperatorPlugin extends Plugin {\n public static override readonly type: string = \"elasticsearch.queryBuilder.operator\";\n\n /**\n * Check if current locale is supported by this plugin.\n */\n // eslint-disable-next-line\n public isLocaleSupported(_: string): boolean {\n return true;\n }\n\n public abstract getOperator(): string;\n\n public abstract apply(\n query: ElasticsearchBoolQueryConfig,\n params: ElasticsearchQueryBuilderArgsPlugin\n ): void;\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAGA;AACA;AACA;AACO,MAAeA,uCAAf,SAA+DC,eAA/D,CAAsE;EAGzE;AACJ;AACA;EACI;EACOC,iBAAiB,CAACC,CAAD,EAAqB;IACzC,OAAO,IAAP;EACH;;AATwE;;;8BAAvDH,uC,UAC6B,qC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ElasticsearchQueryModifierPlugin","Plugin","constructor","callable","modifyQuery","params","WebinyError"],"sources":["ElasticsearchQueryModifierPlugin.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { Plugin } from \"@webiny/plugins\";\nimport { ElasticsearchBoolQueryConfig } from \"~/types\";\n\nexport interface ModifyQueryParams {\n query: ElasticsearchBoolQueryConfig;\n where: Record<string, any>;\n}\n\nexport interface ModifyQueryCallable<T extends ModifyQueryParams> {\n (params: T): void;\n}\n\nexport abstract class ElasticsearchQueryModifierPlugin<\n T extends ModifyQueryParams = ModifyQueryParams\n> extends Plugin {\n private readonly callable?: ModifyQueryCallable<T>;\n\n public constructor(callable?: ModifyQueryCallable<T>) {\n super();\n this.callable = callable;\n }\n\n public modifyQuery(params: T): void {\n if (typeof this.callable !== \"function\") {\n throw new WebinyError(\n `Missing modification for the query.`,\n \"QUERY_MODIFICATION_MISSING\",\n {\n params\n }\n );\n }\n this.callable(params);\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAYO,MAAeA,gCAAf,SAEGC,eAFH,CAEU;EAGNC,WAAW,CAACC,QAAD,EAAoC;IAClD;IADkD;IAElD,KAAKA,QAAL,GAAgBA,QAAhB;EACH;;EAEMC,WAAW,CAACC,MAAD,EAAkB;IAChC,IAAI,OAAO,KAAKF,QAAZ,KAAyB,UAA7B,EAAyC;MACrC,MAAM,IAAIG,cAAJ,CACD,qCADC,EAEF,4BAFE,EAGF;QACID;MADJ,CAHE,CAAN;IAOH;;IACD,KAAKF,QAAL,CAAcE,MAAd;EACH;;AAnBY"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ElasticsearchSortModifierPlugin","Plugin","constructor","callable","modifySort","params","WebinyError"],"sources":["ElasticsearchSortModifierPlugin.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { Plugin } from \"@webiny/plugins\";\nimport { Sort } from \"elastic-ts\";\n\nexport interface ModifySortParams {\n sort: Sort;\n}\n\nexport interface ModifySortCallable<T extends ModifySortParams> {\n (params: T): void;\n}\n\nexport abstract class ElasticsearchSortModifierPlugin<\n T extends ModifySortParams = ModifySortParams\n> extends Plugin {\n private readonly callable?: ModifySortCallable<T>;\n\n public constructor(callable?: ModifySortCallable<T>) {\n super();\n this.callable = callable;\n }\n\n public modifySort(params: T): void {\n if (typeof this.callable !== \"function\") {\n throw new WebinyError(\n `Missing modification for the sort.`,\n \"SORT_MODIFICATION_MISSING\",\n {\n params\n }\n );\n }\n this.callable(params);\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAWO,MAAeA,+BAAf,SAEGC,eAFH,CAEU;EAGNC,WAAW,CAACC,QAAD,EAAmC;IACjD;IADiD;IAEjD,KAAKA,QAAL,GAAgBA,QAAhB;EACH;;EAEMC,UAAU,CAACC,MAAD,EAAkB;IAC/B,IAAI,OAAO,KAAKF,QAAZ,KAAyB,UAA7B,EAAyC;MACrC,MAAM,IAAIG,cAAJ,CACD,oCADC,EAEF,2BAFE,EAGF;QACID;MADJ,CAHE,CAAN;IAOH;;IACD,KAAKF,QAAL,CAAcE,MAAd;EACH;;AAnBY"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./CompressionPlugin";
|
|
2
|
+
export * from "./ElasticsearchBodyModifierPlugin";
|
|
3
|
+
export * from "./ElasticsearchFieldPlugin";
|
|
4
|
+
export * from "./ElasticsearchIndexPlugin";
|
|
5
|
+
export * from "./ElasticsearchQueryBuilderOperatorPlugin";
|
|
6
|
+
export * from "./ElasticsearchQueryModifierPlugin";
|
|
7
|
+
export * from "./ElasticsearchSortModifierPlugin";
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _CompressionPlugin = require("./CompressionPlugin");
|
|
8
|
+
|
|
9
|
+
Object.keys(_CompressionPlugin).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (key in exports && exports[key] === _CompressionPlugin[key]) return;
|
|
12
|
+
Object.defineProperty(exports, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _CompressionPlugin[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
var _ElasticsearchBodyModifierPlugin = require("./ElasticsearchBodyModifierPlugin");
|
|
21
|
+
|
|
22
|
+
Object.keys(_ElasticsearchBodyModifierPlugin).forEach(function (key) {
|
|
23
|
+
if (key === "default" || key === "__esModule") return;
|
|
24
|
+
if (key in exports && exports[key] === _ElasticsearchBodyModifierPlugin[key]) return;
|
|
25
|
+
Object.defineProperty(exports, key, {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return _ElasticsearchBodyModifierPlugin[key];
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
var _ElasticsearchFieldPlugin = require("./ElasticsearchFieldPlugin");
|
|
34
|
+
|
|
35
|
+
Object.keys(_ElasticsearchFieldPlugin).forEach(function (key) {
|
|
36
|
+
if (key === "default" || key === "__esModule") return;
|
|
37
|
+
if (key in exports && exports[key] === _ElasticsearchFieldPlugin[key]) return;
|
|
38
|
+
Object.defineProperty(exports, key, {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function () {
|
|
41
|
+
return _ElasticsearchFieldPlugin[key];
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
var _ElasticsearchIndexPlugin = require("./ElasticsearchIndexPlugin");
|
|
47
|
+
|
|
48
|
+
Object.keys(_ElasticsearchIndexPlugin).forEach(function (key) {
|
|
49
|
+
if (key === "default" || key === "__esModule") return;
|
|
50
|
+
if (key in exports && exports[key] === _ElasticsearchIndexPlugin[key]) return;
|
|
51
|
+
Object.defineProperty(exports, key, {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function () {
|
|
54
|
+
return _ElasticsearchIndexPlugin[key];
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
var _ElasticsearchQueryBuilderOperatorPlugin = require("./ElasticsearchQueryBuilderOperatorPlugin");
|
|
60
|
+
|
|
61
|
+
Object.keys(_ElasticsearchQueryBuilderOperatorPlugin).forEach(function (key) {
|
|
62
|
+
if (key === "default" || key === "__esModule") return;
|
|
63
|
+
if (key in exports && exports[key] === _ElasticsearchQueryBuilderOperatorPlugin[key]) return;
|
|
64
|
+
Object.defineProperty(exports, key, {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: function () {
|
|
67
|
+
return _ElasticsearchQueryBuilderOperatorPlugin[key];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
var _ElasticsearchQueryModifierPlugin = require("./ElasticsearchQueryModifierPlugin");
|
|
73
|
+
|
|
74
|
+
Object.keys(_ElasticsearchQueryModifierPlugin).forEach(function (key) {
|
|
75
|
+
if (key === "default" || key === "__esModule") return;
|
|
76
|
+
if (key in exports && exports[key] === _ElasticsearchQueryModifierPlugin[key]) return;
|
|
77
|
+
Object.defineProperty(exports, key, {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
get: function () {
|
|
80
|
+
return _ElasticsearchQueryModifierPlugin[key];
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
var _ElasticsearchSortModifierPlugin = require("./ElasticsearchSortModifierPlugin");
|
|
86
|
+
|
|
87
|
+
Object.keys(_ElasticsearchSortModifierPlugin).forEach(function (key) {
|
|
88
|
+
if (key === "default" || key === "__esModule") return;
|
|
89
|
+
if (key in exports && exports[key] === _ElasticsearchSortModifierPlugin[key]) return;
|
|
90
|
+
Object.defineProperty(exports, key, {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function () {
|
|
93
|
+
return _ElasticsearchSortModifierPlugin[key];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./CompressionPlugin\";\nexport * from \"./ElasticsearchBodyModifierPlugin\";\nexport * from \"./ElasticsearchFieldPlugin\";\nexport * from \"./ElasticsearchIndexPlugin\";\nexport * from \"./ElasticsearchQueryBuilderOperatorPlugin\";\nexport * from \"./ElasticsearchQueryModifierPlugin\";\nexport * from \"./ElasticsearchSortModifierPlugin\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
package/plugins/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _operator = require("./operator");
|
|
8
|
+
|
|
9
|
+
Object.keys(_operator).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (key in exports && exports[key] === _operator[key]) return;
|
|
12
|
+
Object.defineProperty(exports, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _operator[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
var _definition = require("./definition");
|
|
21
|
+
|
|
22
|
+
Object.keys(_definition).forEach(function (key) {
|
|
23
|
+
if (key === "default" || key === "__esModule") return;
|
|
24
|
+
if (key in exports && exports[key] === _definition[key]) return;
|
|
25
|
+
Object.defineProperty(exports, key, {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return _definition[key];
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./operator\";\nexport * from \"./definition\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
@@ -43,7 +43,7 @@ class ElasticsearchQueryBuilderOperatorAndInPlugin extends _ElasticsearchQueryBu
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
for (const value of values) {
|
|
46
|
-
query.
|
|
46
|
+
query.filter.push({
|
|
47
47
|
term: {
|
|
48
48
|
[useBasePath ? basePath : path]: value
|
|
49
49
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ElasticsearchQueryBuilderOperatorAndInPlugin","ElasticsearchQueryBuilderOperatorPlugin","getOperator","apply","query","params","value","values","path","basePath","isArray","Array","length","Error","useBasePath","filter","push","term"],"sources":["andIn.ts"],"sourcesContent":["import { ElasticsearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin\";\nimport { ElasticsearchBoolQueryConfig, ElasticsearchQueryBuilderArgsPlugin } from \"~/types\";\n\nexport class ElasticsearchQueryBuilderOperatorAndInPlugin extends ElasticsearchQueryBuilderOperatorPlugin {\n public override name = \"elasticsearch.queryBuilder.operator.andIn.default\";\n\n public getOperator(): string {\n return \"and_in\";\n }\n\n public apply(\n query: ElasticsearchBoolQueryConfig,\n params: ElasticsearchQueryBuilderArgsPlugin\n ): void {\n const { value: values, path, basePath } = params;\n const isArray = Array.isArray(values);\n if (isArray === false || values.length === 0) {\n throw new Error(\n `You cannot filter field \"${path}\" with \"in\" operator and not send an array of values.`\n );\n }\n\n let useBasePath = false;\n // Only use \".keyword\" if all of the provided values are strings.\n for (const value of values) {\n if (typeof value !== \"string\") {\n useBasePath = true;\n break;\n }\n }\n\n for (const value of values) {\n query.filter.push({\n term: {\n [useBasePath ? basePath : path]: value\n }\n });\n }\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAGO,MAAMA,4CAAN,SAA2DC,gFAA3D,CAAmG;EAAA;IAAA;IAAA,4CAC/E,mDAD+E;EAAA;;EAG/FC,WAAW,GAAW;IACzB,OAAO,QAAP;EACH;;EAEMC,KAAK,CACRC,KADQ,EAERC,MAFQ,EAGJ;IACJ,MAAM;MAAEC,KAAK,EAAEC,MAAT;MAAiBC,IAAjB;MAAuBC;IAAvB,IAAoCJ,MAA1C;IACA,MAAMK,OAAO,GAAGC,KAAK,CAACD,OAAN,CAAcH,MAAd,CAAhB;;IACA,IAAIG,OAAO,KAAK,KAAZ,IAAqBH,MAAM,CAACK,MAAP,KAAkB,CAA3C,EAA8C;MAC1C,MAAM,IAAIC,KAAJ,CACD,4BAA2BL,IAAK,uDAD/B,CAAN;IAGH;;IAED,IAAIM,WAAW,GAAG,KAAlB,CATI,CAUJ;;IACA,KAAK,MAAMR,KAAX,IAAoBC,MAApB,EAA4B;MACxB,IAAI,OAAOD,KAAP,KAAiB,QAArB,EAA+B;QAC3BQ,WAAW,GAAG,IAAd;QACA;MACH;IACJ;;IAED,KAAK,MAAMR,KAAX,IAAoBC,MAApB,EAA4B;MACxBH,KAAK,CAACW,MAAN,CAAaC,IAAb,CAAkB;QACdC,IAAI,EAAE;UACF,CAACH,WAAW,GAAGL,QAAH,GAAcD,IAA1B,GAAiCF;QAD/B;MADQ,CAAlB;IAKH;EACJ;;AAnCqG"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
@@ -24,19 +24,20 @@ class ElasticsearchQueryBuilderOperatorBetweenPlugin extends _ElasticsearchQuery
|
|
|
24
24
|
apply(query, params) {
|
|
25
25
|
const {
|
|
26
26
|
value,
|
|
27
|
-
basePath
|
|
27
|
+
basePath,
|
|
28
|
+
name
|
|
28
29
|
} = params;
|
|
29
30
|
|
|
30
31
|
if (Array.isArray(value) === false) {
|
|
31
|
-
throw new Error(`You cannot filter field path "${
|
|
32
|
+
throw new Error(`You cannot filter field path "${name}" with between query and not send an array of values.`);
|
|
32
33
|
} else if (value.length !== 2) {
|
|
33
|
-
throw new Error(`You must pass 2 values in the array for field path "${
|
|
34
|
+
throw new Error(`You must pass 2 values in the array for field path "${name}" filtering.`);
|
|
34
35
|
} // we take gte first because it should be a lesser value than lte, eg [5, 10]
|
|
35
36
|
// 6 >= gte && 6 <= lte
|
|
36
37
|
|
|
37
38
|
|
|
38
39
|
const [gte, lte] = value;
|
|
39
|
-
query.
|
|
40
|
+
query.filter.push({
|
|
40
41
|
range: {
|
|
41
42
|
[basePath]: {
|
|
42
43
|
lte,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ElasticsearchQueryBuilderOperatorBetweenPlugin","ElasticsearchQueryBuilderOperatorPlugin","getOperator","apply","query","params","value","basePath","name","Array","isArray","Error","length","gte","lte","filter","push","range"],"sources":["between.ts"],"sourcesContent":["import { ElasticsearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin\";\nimport { ElasticsearchBoolQueryConfig, ElasticsearchQueryBuilderArgsPlugin } from \"~/types\";\n\nexport class ElasticsearchQueryBuilderOperatorBetweenPlugin extends ElasticsearchQueryBuilderOperatorPlugin {\n public override name = \"elasticsearch.queryBuilder.operator.between.default\";\n\n public getOperator(): string {\n return \"between\";\n }\n\n public apply(\n query: ElasticsearchBoolQueryConfig,\n params: ElasticsearchQueryBuilderArgsPlugin\n ): void {\n const { value, basePath, name } = params;\n if (Array.isArray(value) === false) {\n throw new Error(\n `You cannot filter field path \"${name}\" with between query and not send an array of values.`\n );\n } else if (value.length !== 2) {\n throw new Error(\n `You must pass 2 values in the array for field path \"${name}\" filtering.`\n );\n }\n // we take gte first because it should be a lesser value than lte, eg [5, 10]\n // 6 >= gte && 6 <= lte\n const [gte, lte] = value;\n query.filter.push({\n range: {\n [basePath]: {\n lte,\n gte\n }\n }\n });\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAGO,MAAMA,8CAAN,SAA6DC,gFAA7D,CAAqG;EAAA;IAAA;IAAA,4CACjF,qDADiF;EAAA;;EAGjGC,WAAW,GAAW;IACzB,OAAO,SAAP;EACH;;EAEMC,KAAK,CACRC,KADQ,EAERC,MAFQ,EAGJ;IACJ,MAAM;MAAEC,KAAF;MAASC,QAAT;MAAmBC;IAAnB,IAA4BH,MAAlC;;IACA,IAAII,KAAK,CAACC,OAAN,CAAcJ,KAAd,MAAyB,KAA7B,EAAoC;MAChC,MAAM,IAAIK,KAAJ,CACD,iCAAgCH,IAAK,uDADpC,CAAN;IAGH,CAJD,MAIO,IAAIF,KAAK,CAACM,MAAN,KAAiB,CAArB,EAAwB;MAC3B,MAAM,IAAID,KAAJ,CACD,uDAAsDH,IAAK,cAD1D,CAAN;IAGH,CAVG,CAWJ;IACA;;;IACA,MAAM,CAACK,GAAD,EAAMC,GAAN,IAAaR,KAAnB;IACAF,KAAK,CAACW,MAAN,CAAaC,IAAb,CAAkB;MACdC,KAAK,EAAE;QACH,CAACV,QAAD,GAAY;UACRO,GADQ;UAERD;QAFQ;MADT;IADO,CAAlB;EAQH;;AAhCuG"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
@@ -32,7 +32,7 @@ class ElasticsearchQueryBuilderOperatorContainsPlugin extends _ElasticsearchQuer
|
|
|
32
32
|
query_string: {
|
|
33
33
|
allow_leading_wildcard: true,
|
|
34
34
|
fields: [basePath],
|
|
35
|
-
query: (0, _normalize.normalizeValue)(value)
|
|
35
|
+
query: `*${(0, _normalize.normalizeValue)(value)}*`,
|
|
36
36
|
default_operator: "and"
|
|
37
37
|
}
|
|
38
38
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ElasticsearchQueryBuilderOperatorContainsPlugin","ElasticsearchQueryBuilderOperatorPlugin","getOperator","apply","query","params","value","basePath","must","push","query_string","allow_leading_wildcard","fields","normalizeValue","default_operator"],"sources":["contains.ts"],"sourcesContent":["import { ElasticsearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin\";\nimport { normalizeValue } from \"~/normalize\";\nimport { ElasticsearchBoolQueryConfig, ElasticsearchQueryBuilderArgsPlugin } from \"~/types\";\n\nexport class ElasticsearchQueryBuilderOperatorContainsPlugin extends ElasticsearchQueryBuilderOperatorPlugin {\n public override name = \"elasticsearch.queryBuilder.operator.contains.default\";\n\n public getOperator(): string {\n return \"contains\";\n }\n\n public apply(\n query: ElasticsearchBoolQueryConfig,\n params: ElasticsearchQueryBuilderArgsPlugin\n ): void {\n const { value, basePath } = params;\n query.must.push({\n query_string: {\n allow_leading_wildcard: true,\n fields: [basePath],\n query: `*${normalizeValue(value)}*`,\n default_operator: \"and\"\n }\n });\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAGO,MAAMA,+CAAN,SAA8DC,gFAA9D,CAAsG;EAAA;IAAA;IAAA,4CAClF,sDADkF;EAAA;;EAGlGC,WAAW,GAAW;IACzB,OAAO,UAAP;EACH;;EAEMC,KAAK,CACRC,KADQ,EAERC,MAFQ,EAGJ;IACJ,MAAM;MAAEC,KAAF;MAASC;IAAT,IAAsBF,MAA5B;IACAD,KAAK,CAACI,IAAN,CAAWC,IAAX,CAAgB;MACZC,YAAY,EAAE;QACVC,sBAAsB,EAAE,IADd;QAEVC,MAAM,EAAE,CAACL,QAAD,CAFE;QAGVH,KAAK,EAAG,IAAG,IAAAS,yBAAA,EAAeP,KAAf,CAAsB,GAHvB;QAIVQ,gBAAgB,EAAE;MAJR;IADF,CAAhB;EAQH;;AApBwG"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
@@ -27,15 +27,44 @@ class ElasticsearchQueryBuilderOperatorEqualPlugin extends _ElasticsearchQueryBu
|
|
|
27
27
|
path,
|
|
28
28
|
basePath
|
|
29
29
|
} = params;
|
|
30
|
+
|
|
31
|
+
if (value === null) {
|
|
32
|
+
query.must_not.push({
|
|
33
|
+
exists: {
|
|
34
|
+
field: path
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const typeOf = typeof value;
|
|
41
|
+
/**
|
|
42
|
+
* If value is a number or boolean, use filtering instead of must/term
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
if (typeOf === "number" || typeOf === "boolean") {
|
|
46
|
+
query.filter.push({
|
|
47
|
+
term: {
|
|
48
|
+
[basePath]: value
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
30
53
|
/**
|
|
31
54
|
* In case we are searching for a string, use regular path.
|
|
32
|
-
* Otherwise use base path
|
|
55
|
+
* Otherwise use base path.
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
const useBasePath = typeOf !== "string";
|
|
60
|
+
const valuePath = useBasePath ? basePath : path;
|
|
61
|
+
/**
|
|
62
|
+
* String or something else.
|
|
33
63
|
*/
|
|
34
64
|
|
|
35
|
-
|
|
36
|
-
query.must.push({
|
|
65
|
+
query.filter.push({
|
|
37
66
|
term: {
|
|
38
|
-
[
|
|
67
|
+
[valuePath]: value
|
|
39
68
|
}
|
|
40
69
|
});
|
|
41
70
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ElasticsearchQueryBuilderOperatorEqualPlugin","ElasticsearchQueryBuilderOperatorPlugin","getOperator","apply","query","params","value","path","basePath","must_not","push","exists","field","typeOf","filter","term","useBasePath","valuePath"],"sources":["equal.ts"],"sourcesContent":["import { ElasticsearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin\";\nimport { ElasticsearchBoolQueryConfig, ElasticsearchQueryBuilderArgsPlugin } from \"~/types\";\n\nexport class ElasticsearchQueryBuilderOperatorEqualPlugin extends ElasticsearchQueryBuilderOperatorPlugin {\n public override name = \"elasticsearch.queryBuilder.operator.equal.default\";\n\n public getOperator(): string {\n return \"eq\";\n }\n\n public apply(\n query: ElasticsearchBoolQueryConfig,\n params: ElasticsearchQueryBuilderArgsPlugin\n ): void {\n const { value, path, basePath } = params;\n\n if (value === null) {\n query.must_not.push({\n exists: {\n field: path\n }\n });\n return;\n }\n const typeOf = typeof value;\n /**\n * If value is a number or boolean, use filtering instead of must/term\n */\n if (typeOf === \"number\" || typeOf === \"boolean\") {\n query.filter.push({\n term: {\n [basePath]: value\n }\n });\n return;\n }\n /**\n * In case we are searching for a string, use regular path.\n * Otherwise use base path.\n */\n const useBasePath = typeOf !== \"string\";\n const valuePath = useBasePath ? basePath : path;\n /**\n * String or something else.\n */\n query.filter.push({\n term: {\n [valuePath]: value\n }\n });\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAGO,MAAMA,4CAAN,SAA2DC,gFAA3D,CAAmG;EAAA;IAAA;IAAA,4CAC/E,mDAD+E;EAAA;;EAG/FC,WAAW,GAAW;IACzB,OAAO,IAAP;EACH;;EAEMC,KAAK,CACRC,KADQ,EAERC,MAFQ,EAGJ;IACJ,MAAM;MAAEC,KAAF;MAASC,IAAT;MAAeC;IAAf,IAA4BH,MAAlC;;IAEA,IAAIC,KAAK,KAAK,IAAd,EAAoB;MAChBF,KAAK,CAACK,QAAN,CAAeC,IAAf,CAAoB;QAChBC,MAAM,EAAE;UACJC,KAAK,EAAEL;QADH;MADQ,CAApB;MAKA;IACH;;IACD,MAAMM,MAAM,GAAG,OAAOP,KAAtB;IACA;AACR;AACA;;IACQ,IAAIO,MAAM,KAAK,QAAX,IAAuBA,MAAM,KAAK,SAAtC,EAAiD;MAC7CT,KAAK,CAACU,MAAN,CAAaJ,IAAb,CAAkB;QACdK,IAAI,EAAE;UACF,CAACP,QAAD,GAAYF;QADV;MADQ,CAAlB;MAKA;IACH;IACD;AACR;AACA;AACA;;;IACQ,MAAMU,WAAW,GAAGH,MAAM,KAAK,QAA/B;IACA,MAAMI,SAAS,GAAGD,WAAW,GAAGR,QAAH,GAAcD,IAA3C;IACA;AACR;AACA;;IACQH,KAAK,CAACU,MAAN,CAAaJ,IAAb,CAAkB;MACdK,IAAI,EAAE;QACF,CAACE,SAAD,GAAaX;MADX;IADQ,CAAlB;EAKH;;AA/CqG"}
|
package/plugins/operator/gt.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
@@ -26,7 +26,7 @@ class ElasticsearchQueryBuilderOperatorGreaterThanPlugin extends _ElasticsearchQ
|
|
|
26
26
|
value,
|
|
27
27
|
basePath
|
|
28
28
|
} = params;
|
|
29
|
-
query.
|
|
29
|
+
query.filter.push({
|
|
30
30
|
range: {
|
|
31
31
|
[basePath]: {
|
|
32
32
|
gt: value
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ElasticsearchQueryBuilderOperatorGreaterThanPlugin","ElasticsearchQueryBuilderOperatorPlugin","getOperator","apply","query","params","value","basePath","filter","push","range","gt"],"sources":["gt.ts"],"sourcesContent":["import { ElasticsearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin\";\nimport { ElasticsearchBoolQueryConfig, ElasticsearchQueryBuilderArgsPlugin } from \"~/types\";\n\nexport class ElasticsearchQueryBuilderOperatorGreaterThanPlugin extends ElasticsearchQueryBuilderOperatorPlugin {\n public override name = \"elasticsearch.queryBuilder.operator.greaterThan.default\";\n\n public getOperator(): string {\n return \"gt\";\n }\n\n public apply(\n query: ElasticsearchBoolQueryConfig,\n params: ElasticsearchQueryBuilderArgsPlugin\n ): void {\n const { value, basePath } = params;\n query.filter.push({\n range: {\n [basePath]: {\n gt: value\n }\n }\n });\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAGO,MAAMA,kDAAN,SAAiEC,gFAAjE,CAAyG;EAAA;IAAA;IAAA,4CACrF,yDADqF;EAAA;;EAGrGC,WAAW,GAAW;IACzB,OAAO,IAAP;EACH;;EAEMC,KAAK,CACRC,KADQ,EAERC,MAFQ,EAGJ;IACJ,MAAM;MAAEC,KAAF;MAASC;IAAT,IAAsBF,MAA5B;IACAD,KAAK,CAACI,MAAN,CAAaC,IAAb,CAAkB;MACdC,KAAK,EAAE;QACH,CAACH,QAAD,GAAY;UACRI,EAAE,EAAEL;QADI;MADT;IADO,CAAlB;EAOH;;AAnB2G"}
|
package/plugins/operator/gte.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
@@ -26,7 +26,7 @@ class ElasticsearchQueryBuilderOperatorGreaterThanOrEqualToPlugin extends _Elast
|
|
|
26
26
|
value,
|
|
27
27
|
basePath
|
|
28
28
|
} = params;
|
|
29
|
-
query.
|
|
29
|
+
query.filter.push({
|
|
30
30
|
range: {
|
|
31
31
|
[basePath]: {
|
|
32
32
|
gte: value
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ElasticsearchQueryBuilderOperatorGreaterThanOrEqualToPlugin","ElasticsearchQueryBuilderOperatorPlugin","getOperator","apply","query","params","value","basePath","filter","push","range","gte"],"sources":["gte.ts"],"sourcesContent":["import { ElasticsearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin\";\nimport { ElasticsearchBoolQueryConfig, ElasticsearchQueryBuilderArgsPlugin } from \"~/types\";\n\nexport class ElasticsearchQueryBuilderOperatorGreaterThanOrEqualToPlugin extends ElasticsearchQueryBuilderOperatorPlugin {\n public override name = \"elasticsearch.queryBuilder.operator.greaterThanOrEqualTo.default\";\n\n public getOperator(): string {\n return \"gte\";\n }\n\n public apply(\n query: ElasticsearchBoolQueryConfig,\n params: ElasticsearchQueryBuilderArgsPlugin\n ): void {\n const { value, basePath } = params;\n query.filter.push({\n range: {\n [basePath]: {\n gte: value\n }\n }\n });\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAGO,MAAMA,2DAAN,SAA0EC,gFAA1E,CAAkH;EAAA;IAAA;IAAA,4CAC9F,kEAD8F;EAAA;;EAG9GC,WAAW,GAAW;IACzB,OAAO,KAAP;EACH;;EAEMC,KAAK,CACRC,KADQ,EAERC,MAFQ,EAGJ;IACJ,MAAM;MAAEC,KAAF;MAASC;IAAT,IAAsBF,MAA5B;IACAD,KAAK,CAACI,MAAN,CAAaC,IAAb,CAAkB;MACdC,KAAK,EAAE;QACH,CAACH,QAAD,GAAY;UACRI,GAAG,EAAEL;QADG;MADT;IADO,CAAlB;EAOH;;AAnBoH"}
|
package/plugins/operator/in.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
@@ -25,24 +25,18 @@ class ElasticsearchQueryBuilderOperatorInPlugin extends _ElasticsearchQueryBuild
|
|
|
25
25
|
const {
|
|
26
26
|
value: values,
|
|
27
27
|
path,
|
|
28
|
-
basePath
|
|
28
|
+
basePath,
|
|
29
|
+
name
|
|
29
30
|
} = params;
|
|
30
31
|
const isArray = Array.isArray(values);
|
|
31
32
|
|
|
32
33
|
if (isArray === false || values.length === 0) {
|
|
33
|
-
throw new Error(`You cannot filter field "${
|
|
34
|
-
}
|
|
34
|
+
throw new Error(`You cannot filter field "${name}" with "in" operator and not send an array of values.`);
|
|
35
|
+
} // Only use ".keyword" if all of the provided values are strings.
|
|
35
36
|
|
|
36
|
-
let useBasePath = false; // Only use ".keyword" if all of the provided values are strings.
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
useBasePath = true;
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
query.must.push({
|
|
38
|
+
const useBasePath = values.some(value => typeof value !== "string");
|
|
39
|
+
query.filter.push({
|
|
46
40
|
terms: {
|
|
47
41
|
[useBasePath ? basePath : path]: values
|
|
48
42
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ElasticsearchQueryBuilderOperatorInPlugin","ElasticsearchQueryBuilderOperatorPlugin","getOperator","apply","query","params","value","values","path","basePath","name","isArray","Array","length","Error","useBasePath","some","filter","push","terms"],"sources":["in.ts"],"sourcesContent":["import { ElasticsearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin\";\nimport { ElasticsearchBoolQueryConfig, ElasticsearchQueryBuilderArgsPlugin } from \"~/types\";\n\nexport class ElasticsearchQueryBuilderOperatorInPlugin extends ElasticsearchQueryBuilderOperatorPlugin {\n public override name = \"elasticsearch.queryBuilder.operator.in.default\";\n\n public getOperator(): string {\n return \"in\";\n }\n\n public apply(\n query: ElasticsearchBoolQueryConfig,\n params: ElasticsearchQueryBuilderArgsPlugin\n ): void {\n const { value: values, path, basePath, name } = params;\n const isArray = Array.isArray(values);\n if (isArray === false || values.length === 0) {\n throw new Error(\n `You cannot filter field \"${name}\" with \"in\" operator and not send an array of values.`\n );\n }\n\n // Only use \".keyword\" if all of the provided values are strings.\n const useBasePath = values.some(\n (value: string | number | boolean | null | undefined) => typeof value !== \"string\"\n );\n\n query.filter.push({\n terms: {\n [useBasePath ? basePath : path]: values\n }\n });\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAGO,MAAMA,yCAAN,SAAwDC,gFAAxD,CAAgG;EAAA;IAAA;IAAA,4CAC5E,gDAD4E;EAAA;;EAG5FC,WAAW,GAAW;IACzB,OAAO,IAAP;EACH;;EAEMC,KAAK,CACRC,KADQ,EAERC,MAFQ,EAGJ;IACJ,MAAM;MAAEC,KAAK,EAAEC,MAAT;MAAiBC,IAAjB;MAAuBC,QAAvB;MAAiCC;IAAjC,IAA0CL,MAAhD;IACA,MAAMM,OAAO,GAAGC,KAAK,CAACD,OAAN,CAAcJ,MAAd,CAAhB;;IACA,IAAII,OAAO,KAAK,KAAZ,IAAqBJ,MAAM,CAACM,MAAP,KAAkB,CAA3C,EAA8C;MAC1C,MAAM,IAAIC,KAAJ,CACD,4BAA2BJ,IAAK,uDAD/B,CAAN;IAGH,CAPG,CASJ;;;IACA,MAAMK,WAAW,GAAGR,MAAM,CAACS,IAAP,CACfV,KAAD,IAAyD,OAAOA,KAAP,KAAiB,QAD1D,CAApB;IAIAF,KAAK,CAACa,MAAN,CAAaC,IAAb,CAAkB;MACdC,KAAK,EAAE;QACH,CAACJ,WAAW,GAAGN,QAAH,GAAcD,IAA1B,GAAiCD;MAD9B;IADO,CAAlB;EAKH;;AA7BkG"}
|
|
@@ -171,4 +171,43 @@ Object.keys(_notIn).forEach(function (key) {
|
|
|
171
171
|
return _notIn[key];
|
|
172
172
|
}
|
|
173
173
|
});
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
var _startsWith = require("./startsWith");
|
|
177
|
+
|
|
178
|
+
Object.keys(_startsWith).forEach(function (key) {
|
|
179
|
+
if (key === "default" || key === "__esModule") return;
|
|
180
|
+
if (key in exports && exports[key] === _startsWith[key]) return;
|
|
181
|
+
Object.defineProperty(exports, key, {
|
|
182
|
+
enumerable: true,
|
|
183
|
+
get: function () {
|
|
184
|
+
return _startsWith[key];
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
var _notStartsWith = require("./notStartsWith");
|
|
190
|
+
|
|
191
|
+
Object.keys(_notStartsWith).forEach(function (key) {
|
|
192
|
+
if (key === "default" || key === "__esModule") return;
|
|
193
|
+
if (key in exports && exports[key] === _notStartsWith[key]) return;
|
|
194
|
+
Object.defineProperty(exports, key, {
|
|
195
|
+
enumerable: true,
|
|
196
|
+
get: function () {
|
|
197
|
+
return _notStartsWith[key];
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
var _contains2 = require("./japanese/contains");
|
|
203
|
+
|
|
204
|
+
Object.keys(_contains2).forEach(function (key) {
|
|
205
|
+
if (key === "default" || key === "__esModule") return;
|
|
206
|
+
if (key in exports && exports[key] === _contains2[key]) return;
|
|
207
|
+
Object.defineProperty(exports, key, {
|
|
208
|
+
enumerable: true,
|
|
209
|
+
get: function () {
|
|
210
|
+
return _contains2[key];
|
|
211
|
+
}
|
|
212
|
+
});
|
|
174
213
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./between\";\nexport * from \"./contains\";\nexport * from \"./equal\";\nexport * from \"./gt\";\nexport * from \"./gte\";\nexport * from \"./andIn\";\nexport * from \"./in\";\nexport * from \"./lt\";\nexport * from \"./lte\";\nexport * from \"./not\";\nexport * from \"./notBetween\";\nexport * from \"./notContains\";\nexport * from \"./notIn\";\nexport * from \"./startsWith\";\nexport * from \"./notStartsWith\";\nexport * from \"./japanese/contains\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ElasticsearchQueryBuilderOperatorPlugin } from "../../definition/ElasticsearchQueryBuilderOperatorPlugin";
|
|
2
|
+
import { ElasticsearchBoolQueryConfig, ElasticsearchQueryBuilderArgsPlugin } from "../../../types";
|
|
3
|
+
export declare class ElasticsearchQueryBuilderJapaneseOperatorContainsPlugin extends ElasticsearchQueryBuilderOperatorPlugin {
|
|
4
|
+
name: string;
|
|
5
|
+
isLocaleSupported(code: string): boolean;
|
|
6
|
+
getOperator(): string;
|
|
7
|
+
apply(query: ElasticsearchBoolQueryConfig, params: ElasticsearchQueryBuilderArgsPlugin): void;
|
|
8
|
+
}
|