@webiny/api-elasticsearch 0.0.0-unstable.eb196ccd2f → 0.0.0-unstable.f6dc066313
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/README.md +10 -0
- package/client.d.ts +2 -2
- package/client.js +11 -30
- package/client.js.map +1 -1
- package/compression.js +7 -14
- package/compression.js.map +1 -1
- package/cursors.d.ts +1 -1
- package/cursors.js +2 -10
- package/cursors.js.map +1 -1
- package/db/entity.d.ts +7 -0
- package/db/entity.js +20 -0
- package/db/entity.js.map +1 -0
- package/db/index.d.ts +3 -0
- package/db/index.js +5 -0
- package/db/index.js.map +1 -0
- package/db/table.d.ts +7 -0
- package/db/table.js +17 -0
- package/db/table.js.map +1 -0
- package/db/types.d.ts +6 -0
- package/db/types.js +3 -0
- package/db/types.js.map +1 -0
- package/index.d.ts +18 -17
- package/index.js +27 -197
- package/index.js.map +1 -1
- package/indexConfiguration/base.d.ts +1 -1
- package/indexConfiguration/base.js +3 -10
- package/indexConfiguration/base.js.map +1 -1
- package/indexConfiguration/common.d.ts +1 -1
- package/indexConfiguration/common.js +1 -8
- package/indexConfiguration/common.js.map +1 -1
- package/indexConfiguration/index.d.ts +2 -3
- package/indexConfiguration/index.js +2 -38
- package/indexConfiguration/index.js.map +1 -1
- package/indexPrefix.js +2 -9
- package/indexPrefix.js.map +1 -1
- package/indices.d.ts +1 -2
- package/indices.js +6 -16
- package/indices.js.map +1 -1
- package/limit.js +1 -8
- package/limit.js.map +1 -1
- package/normalize.js +3 -11
- package/normalize.js.map +1 -1
- package/operations/ElasticsearchCatHealth.d.ts +2 -2
- package/operations/ElasticsearchCatHealth.js +6 -13
- package/operations/ElasticsearchCatHealth.js.map +1 -1
- package/operations/ElasticsearchCatNodes.d.ts +2 -2
- package/operations/ElasticsearchCatNodes.js +6 -13
- package/operations/ElasticsearchCatNodes.js.map +1 -1
- package/operations/index.d.ts +3 -3
- package/operations/index.js +3 -38
- package/operations/index.js.map +1 -1
- package/operations/stripConnectionFromException.js +1 -8
- package/operations/stripConnectionFromException.js.map +1 -1
- package/operations/types.js +1 -7
- package/operations/types.js.map +1 -1
- package/operators.d.ts +2 -5
- package/operators.js +3 -41
- package/operators.js.map +1 -1
- package/package.json +13 -12
- package/plugins/definition/ElasticsearchBodyModifierPlugin.js +4 -12
- package/plugins/definition/ElasticsearchBodyModifierPlugin.js.map +1 -1
- package/plugins/definition/ElasticsearchFieldPlugin.js +2 -9
- package/plugins/definition/ElasticsearchFieldPlugin.js.map +1 -1
- package/plugins/definition/ElasticsearchIndexPlugin.d.ts +2 -10
- package/plugins/definition/ElasticsearchIndexPlugin.js +4 -23
- package/plugins/definition/ElasticsearchIndexPlugin.js.map +1 -1
- package/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.d.ts +1 -5
- package/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.js +2 -17
- package/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.js.map +1 -1
- package/plugins/definition/ElasticsearchQueryModifierPlugin.d.ts +1 -1
- package/plugins/definition/ElasticsearchQueryModifierPlugin.js +4 -12
- package/plugins/definition/ElasticsearchQueryModifierPlugin.js.map +1 -1
- package/plugins/definition/ElasticsearchSortModifierPlugin.js +4 -12
- package/plugins/definition/ElasticsearchSortModifierPlugin.js.map +1 -1
- package/plugins/definition/index.d.ts +6 -6
- package/plugins/definition/index.js +6 -71
- package/plugins/definition/index.js.map +1 -1
- package/plugins/index.d.ts +2 -2
- package/plugins/index.js +2 -27
- package/plugins/index.js.map +1 -1
- package/plugins/operator/andIn.d.ts +2 -2
- package/plugins/operator/andIn.js +2 -9
- package/plugins/operator/andIn.js.map +1 -1
- package/plugins/operator/between.d.ts +2 -2
- package/plugins/operator/between.js +2 -9
- package/plugins/operator/between.js.map +1 -1
- package/plugins/operator/contains.d.ts +2 -2
- package/plugins/operator/contains.js +4 -11
- package/plugins/operator/contains.js.map +1 -1
- package/plugins/operator/equal.d.ts +2 -2
- package/plugins/operator/equal.js +2 -9
- package/plugins/operator/equal.js.map +1 -1
- package/plugins/operator/gt.d.ts +2 -2
- package/plugins/operator/gt.js +2 -9
- package/plugins/operator/gt.js.map +1 -1
- package/plugins/operator/gte.d.ts +2 -2
- package/plugins/operator/gte.js +2 -9
- package/plugins/operator/gte.js.map +1 -1
- package/plugins/operator/in.d.ts +2 -2
- package/plugins/operator/in.js +2 -9
- package/plugins/operator/in.js.map +1 -1
- package/plugins/operator/index.d.ts +15 -16
- package/plugins/operator/index.js +15 -181
- package/plugins/operator/index.js.map +1 -1
- package/plugins/operator/lt.d.ts +2 -2
- package/plugins/operator/lt.js +2 -9
- package/plugins/operator/lt.js.map +1 -1
- package/plugins/operator/lte.d.ts +2 -2
- package/plugins/operator/lte.js +2 -9
- package/plugins/operator/lte.js.map +1 -1
- package/plugins/operator/not.d.ts +2 -2
- package/plugins/operator/not.js +2 -9
- package/plugins/operator/not.js.map +1 -1
- package/plugins/operator/notBetween.d.ts +2 -2
- package/plugins/operator/notBetween.js +2 -9
- package/plugins/operator/notBetween.js.map +1 -1
- package/plugins/operator/notContains.d.ts +2 -2
- package/plugins/operator/notContains.js +4 -11
- package/plugins/operator/notContains.js.map +1 -1
- package/plugins/operator/notIn.d.ts +2 -2
- package/plugins/operator/notIn.js +2 -9
- package/plugins/operator/notIn.js.map +1 -1
- package/plugins/operator/notStartsWith.d.ts +2 -2
- package/plugins/operator/notStartsWith.js +2 -9
- package/plugins/operator/notStartsWith.js.map +1 -1
- package/plugins/operator/startsWith.d.ts +2 -2
- package/plugins/operator/startsWith.js +2 -9
- package/plugins/operator/startsWith.js.map +1 -1
- package/sharedIndex.js +2 -9
- package/sharedIndex.js.map +1 -1
- package/sort.d.ts +2 -2
- package/sort.js +8 -16
- package/sort.js.map +1 -1
- package/types.d.ts +3 -3
- package/types.js +28 -26
- package/types.js.map +1 -1
- package/utils/createIndex.d.ts +0 -1
- package/utils/createIndex.js +7 -19
- package/utils/createIndex.js.map +1 -1
- package/utils/index.d.ts +3 -3
- package/utils/index.js +3 -27
- package/utils/index.js.map +1 -1
- package/utils/waitUntilHealthy/UnhealthyClusterError.js +2 -9
- package/utils/waitUntilHealthy/UnhealthyClusterError.js.map +1 -1
- package/utils/waitUntilHealthy/WaitUntilHealthy.d.ts +3 -3
- package/utils/waitUntilHealthy/WaitUntilHealthy.js +22 -29
- package/utils/waitUntilHealthy/WaitUntilHealthy.js.map +1 -1
- package/utils/waitUntilHealthy/WaitingHealthyClusterAbortedError.js +2 -9
- package/utils/waitUntilHealthy/WaitingHealthyClusterAbortedError.js.map +1 -1
- package/utils/waitUntilHealthy/index.d.ts +6 -6
- package/utils/waitUntilHealthy/index.js +6 -49
- package/utils/waitUntilHealthy/index.js.map +1 -1
- package/utils/waitUntilHealthy/reason/ClusterHealthReason.d.ts +2 -2
- package/utils/waitUntilHealthy/reason/ClusterHealthReason.js +2 -10
- package/utils/waitUntilHealthy/reason/ClusterHealthReason.js.map +1 -1
- package/utils/waitUntilHealthy/reason/IReason.js +1 -5
- package/utils/waitUntilHealthy/reason/MemoryReason.d.ts +1 -1
- package/utils/waitUntilHealthy/reason/MemoryReason.js +2 -10
- package/utils/waitUntilHealthy/reason/MemoryReason.js.map +1 -1
- package/utils/waitUntilHealthy/reason/ProcessorReason.d.ts +1 -1
- package/utils/waitUntilHealthy/reason/ProcessorReason.js +2 -10
- package/utils/waitUntilHealthy/reason/ProcessorReason.js.map +1 -1
- package/utils/waitUntilHealthy/reason/index.d.ts +3 -3
- package/utils/waitUntilHealthy/reason/index.js +3 -38
- package/utils/waitUntilHealthy/reason/index.js.map +1 -1
- package/where.d.ts +3 -3
- package/where.js +7 -16
- package/where.js.map +1 -1
- package/indexConfiguration/japanese.d.ts +0 -6
- package/indexConfiguration/japanese.js +0 -121
- package/indexConfiguration/japanese.js.map +0 -1
- package/plugins/operator/japanese/contains.d.ts +0 -8
- package/plugins/operator/japanese/contains.js +0 -44
- package/plugins/operator/japanese/contains.js.map +0 -1
package/operations/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ElasticsearchCatClusterHealthStatus"
|
|
1
|
+
{"version":3,"names":["ElasticsearchCatClusterHealthStatus"],"sources":["types.ts"],"sourcesContent":["export enum ElasticsearchCatClusterHealthStatus {\n Green = \"green\",\n Yellow = \"yellow\",\n Red = \"red\"\n}\n\nexport interface IElasticsearchCatHealthResponse {\n epoch: number;\n timestamp: `${number}:${number}:${number}`;\n cluster: string;\n status: ElasticsearchCatClusterHealthStatus;\n \"node.total\": `${number}`;\n \"node.data\": `${number}`;\n shards: `${number}`;\n pri: `${number}`;\n relo: `${number}`;\n init: `${number}`;\n unassign: `${number}`;\n pending_tasks: `${number}`;\n max_task_wait_time: string;\n active_shards_percent: `${number}%`;\n discovered_cluster_manager?: `${boolean}`;\n}\n\nexport interface IElasticsearchCatNodeResponse {\n ip: string;\n \"heap.percent\": `${number}`;\n \"ram.percent\": `${number}`;\n cpu: `${number}`;\n load_1m: `${number}` | null;\n load_5m: `${number}` | null;\n load_15m: `${number}` | null;\n \"node.role\": string;\n master?: string;\n name: string;\n}\n\nexport type IElasticsearchCatNodesResponse = IElasticsearchCatNodeResponse[];\n"],"mappings":"AAAA,WAAYA,mCAAmC,0BAAnCA,mCAAmC;EAAnCA,mCAAmC;EAAnCA,mCAAmC;EAAnCA,mCAAmC;EAAA,OAAnCA,mCAAmC;AAAA","ignoreList":[]}
|
package/operators.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { ElasticsearchQueryBuilderOperatorBetweenPlugin,
|
|
2
|
-
import type { PluginsContainer } from "@webiny/plugins";
|
|
3
|
-
import { ElasticsearchQueryBuilderOperatorPlugin } from "./plugins/definition/ElasticsearchQueryBuilderOperatorPlugin";
|
|
1
|
+
import { ElasticsearchQueryBuilderOperatorBetweenPlugin, ElasticsearchQueryBuilderOperatorAndInPlugin, ElasticsearchQueryBuilderOperatorGreaterThanOrEqualToPlugin, ElasticsearchQueryBuilderOperatorGreaterThanPlugin, ElasticsearchQueryBuilderOperatorContainsPlugin, ElasticsearchQueryBuilderOperatorLesserThanOrEqualToPlugin, ElasticsearchQueryBuilderOperatorInPlugin, ElasticsearchQueryBuilderOperatorLesserThanPlugin, ElasticsearchQueryBuilderOperatorNotBetweenPlugin, ElasticsearchQueryBuilderOperatorNotContainsPlugin, ElasticsearchQueryBuilderOperatorNotPlugin, ElasticsearchQueryBuilderOperatorNotInPlugin, ElasticsearchQueryBuilderOperatorEqualPlugin, ElasticsearchQueryBuilderOperatorStartsWithPlugin, ElasticsearchQueryBuilderOperatorNotStartsWithPlugin } from "./plugins/operator/index.js";
|
|
4
2
|
/**
|
|
5
3
|
* We export as a function because there might be something to be sent to the operators at some point.
|
|
6
4
|
* This way, we make it easier to upgrade.
|
|
7
5
|
*/
|
|
8
|
-
export declare const getElasticsearchOperators: () => (ElasticsearchQueryBuilderOperatorBetweenPlugin | ElasticsearchQueryBuilderOperatorContainsPlugin | ElasticsearchQueryBuilderOperatorEqualPlugin | ElasticsearchQueryBuilderOperatorGreaterThanPlugin | ElasticsearchQueryBuilderOperatorGreaterThanOrEqualToPlugin | ElasticsearchQueryBuilderOperatorAndInPlugin | ElasticsearchQueryBuilderOperatorInPlugin | ElasticsearchQueryBuilderOperatorLesserThanPlugin | ElasticsearchQueryBuilderOperatorLesserThanOrEqualToPlugin | ElasticsearchQueryBuilderOperatorNotPlugin | ElasticsearchQueryBuilderOperatorNotBetweenPlugin | ElasticsearchQueryBuilderOperatorNotContainsPlugin | ElasticsearchQueryBuilderOperatorNotInPlugin | ElasticsearchQueryBuilderOperatorStartsWithPlugin | ElasticsearchQueryBuilderOperatorNotStartsWithPlugin
|
|
9
|
-
export declare const getElasticsearchOperatorPluginsByLocale: (plugins: PluginsContainer, locale: string) => Record<string, ElasticsearchQueryBuilderOperatorPlugin>;
|
|
6
|
+
export declare const getElasticsearchOperators: () => (ElasticsearchQueryBuilderOperatorBetweenPlugin | ElasticsearchQueryBuilderOperatorContainsPlugin | ElasticsearchQueryBuilderOperatorEqualPlugin | ElasticsearchQueryBuilderOperatorGreaterThanPlugin | ElasticsearchQueryBuilderOperatorGreaterThanOrEqualToPlugin | ElasticsearchQueryBuilderOperatorAndInPlugin | ElasticsearchQueryBuilderOperatorInPlugin | ElasticsearchQueryBuilderOperatorLesserThanPlugin | ElasticsearchQueryBuilderOperatorLesserThanOrEqualToPlugin | ElasticsearchQueryBuilderOperatorNotPlugin | ElasticsearchQueryBuilderOperatorNotBetweenPlugin | ElasticsearchQueryBuilderOperatorNotContainsPlugin | ElasticsearchQueryBuilderOperatorNotInPlugin | ElasticsearchQueryBuilderOperatorStartsWithPlugin | ElasticsearchQueryBuilderOperatorNotStartsWithPlugin)[];
|
package/operators.js
CHANGED
|
@@ -1,47 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getElasticsearchOperators = exports.getElasticsearchOperatorPluginsByLocale = void 0;
|
|
7
|
-
var _operator = require("./plugins/operator");
|
|
8
|
-
var _ElasticsearchQueryBuilderOperatorPlugin = require("./plugins/definition/ElasticsearchQueryBuilderOperatorPlugin");
|
|
9
|
-
const operators = [new _operator.ElasticsearchQueryBuilderOperatorBetweenPlugin(), new _operator.ElasticsearchQueryBuilderOperatorNotBetweenPlugin(), new _operator.ElasticsearchQueryBuilderOperatorContainsPlugin(), new _operator.ElasticsearchQueryBuilderOperatorNotContainsPlugin(), new _operator.ElasticsearchQueryBuilderOperatorEqualPlugin(), new _operator.ElasticsearchQueryBuilderOperatorNotPlugin(), new _operator.ElasticsearchQueryBuilderOperatorGreaterThanPlugin(), new _operator.ElasticsearchQueryBuilderOperatorGreaterThanOrEqualToPlugin(), new _operator.ElasticsearchQueryBuilderOperatorLesserThanPlugin(), new _operator.ElasticsearchQueryBuilderOperatorLesserThanOrEqualToPlugin(), new _operator.ElasticsearchQueryBuilderOperatorInPlugin(), new _operator.ElasticsearchQueryBuilderOperatorAndInPlugin(), new _operator.ElasticsearchQueryBuilderOperatorNotInPlugin(), new _operator.ElasticsearchQueryBuilderOperatorStartsWithPlugin(), new _operator.ElasticsearchQueryBuilderOperatorNotStartsWithPlugin(),
|
|
10
|
-
/**
|
|
11
|
-
* Japanese
|
|
12
|
-
*/
|
|
13
|
-
new _operator.ElasticsearchQueryBuilderJapaneseOperatorContainsPlugin()];
|
|
1
|
+
import { ElasticsearchQueryBuilderOperatorBetweenPlugin, ElasticsearchQueryBuilderOperatorAndInPlugin, ElasticsearchQueryBuilderOperatorGreaterThanOrEqualToPlugin, ElasticsearchQueryBuilderOperatorGreaterThanPlugin, ElasticsearchQueryBuilderOperatorContainsPlugin, ElasticsearchQueryBuilderOperatorLesserThanOrEqualToPlugin, ElasticsearchQueryBuilderOperatorInPlugin, ElasticsearchQueryBuilderOperatorLesserThanPlugin, ElasticsearchQueryBuilderOperatorNotBetweenPlugin, ElasticsearchQueryBuilderOperatorNotContainsPlugin, ElasticsearchQueryBuilderOperatorNotPlugin, ElasticsearchQueryBuilderOperatorNotInPlugin, ElasticsearchQueryBuilderOperatorEqualPlugin, ElasticsearchQueryBuilderOperatorStartsWithPlugin, ElasticsearchQueryBuilderOperatorNotStartsWithPlugin } from "./plugins/operator/index.js";
|
|
2
|
+
const operators = [new ElasticsearchQueryBuilderOperatorBetweenPlugin(), new ElasticsearchQueryBuilderOperatorNotBetweenPlugin(), new ElasticsearchQueryBuilderOperatorContainsPlugin(), new ElasticsearchQueryBuilderOperatorNotContainsPlugin(), new ElasticsearchQueryBuilderOperatorEqualPlugin(), new ElasticsearchQueryBuilderOperatorNotPlugin(), new ElasticsearchQueryBuilderOperatorGreaterThanPlugin(), new ElasticsearchQueryBuilderOperatorGreaterThanOrEqualToPlugin(), new ElasticsearchQueryBuilderOperatorLesserThanPlugin(), new ElasticsearchQueryBuilderOperatorLesserThanOrEqualToPlugin(), new ElasticsearchQueryBuilderOperatorInPlugin(), new ElasticsearchQueryBuilderOperatorAndInPlugin(), new ElasticsearchQueryBuilderOperatorNotInPlugin(), new ElasticsearchQueryBuilderOperatorStartsWithPlugin(), new ElasticsearchQueryBuilderOperatorNotStartsWithPlugin()];
|
|
14
3
|
/**
|
|
15
4
|
* We export as a function because there might be something to be sent to the operators at some point.
|
|
16
5
|
* This way, we make it easier to upgrade.
|
|
17
6
|
*/
|
|
18
|
-
const getElasticsearchOperators = () => operators;
|
|
19
|
-
exports.getElasticsearchOperators = getElasticsearchOperators;
|
|
20
|
-
const getElasticsearchOperatorPluginsByLocale = (plugins, locale) => {
|
|
21
|
-
/**
|
|
22
|
-
* We always set the last one operator plugin added.
|
|
23
|
-
* This way user can override the plugins.
|
|
24
|
-
*/
|
|
25
|
-
return plugins.byType(_ElasticsearchQueryBuilderOperatorPlugin.ElasticsearchQueryBuilderOperatorPlugin.type).reduce((acc, plugin) => {
|
|
26
|
-
const op = plugin.getOperator();
|
|
27
|
-
/**
|
|
28
|
-
* We only allow the plugins which can pass the locale test.
|
|
29
|
-
* The default plugins always return true.
|
|
30
|
-
*/
|
|
31
|
-
if (plugin.isLocaleSupported(locale) === false) {
|
|
32
|
-
return acc;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* We also only allow the override of the plugins if the new plugin is NOT a default one.
|
|
36
|
-
* If a user names the plugin with .default, we cannot do anything about it.
|
|
37
|
-
*/
|
|
38
|
-
if (!!acc[op] && (plugin.name || "").match(/\.default$/)) {
|
|
39
|
-
return acc;
|
|
40
|
-
}
|
|
41
|
-
acc[op] = plugin;
|
|
42
|
-
return acc;
|
|
43
|
-
}, {});
|
|
44
|
-
};
|
|
45
|
-
exports.getElasticsearchOperatorPluginsByLocale = getElasticsearchOperatorPluginsByLocale;
|
|
7
|
+
export const getElasticsearchOperators = () => operators;
|
|
46
8
|
|
|
47
9
|
//# sourceMappingURL=operators.js.map
|
package/operators.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["ElasticsearchQueryBuilderOperatorBetweenPlugin","ElasticsearchQueryBuilderOperatorAndInPlugin","ElasticsearchQueryBuilderOperatorGreaterThanOrEqualToPlugin","ElasticsearchQueryBuilderOperatorGreaterThanPlugin","ElasticsearchQueryBuilderOperatorContainsPlugin","ElasticsearchQueryBuilderOperatorLesserThanOrEqualToPlugin","ElasticsearchQueryBuilderOperatorInPlugin","ElasticsearchQueryBuilderOperatorLesserThanPlugin","ElasticsearchQueryBuilderOperatorNotBetweenPlugin","ElasticsearchQueryBuilderOperatorNotContainsPlugin","ElasticsearchQueryBuilderOperatorNotPlugin","ElasticsearchQueryBuilderOperatorNotInPlugin","ElasticsearchQueryBuilderOperatorEqualPlugin","ElasticsearchQueryBuilderOperatorStartsWithPlugin","ElasticsearchQueryBuilderOperatorNotStartsWithPlugin","operators","getElasticsearchOperators"],"sources":["operators.ts"],"sourcesContent":["import {\n ElasticsearchQueryBuilderOperatorBetweenPlugin,\n ElasticsearchQueryBuilderOperatorAndInPlugin,\n ElasticsearchQueryBuilderOperatorGreaterThanOrEqualToPlugin,\n ElasticsearchQueryBuilderOperatorGreaterThanPlugin,\n ElasticsearchQueryBuilderOperatorContainsPlugin,\n ElasticsearchQueryBuilderOperatorLesserThanOrEqualToPlugin,\n ElasticsearchQueryBuilderOperatorInPlugin,\n ElasticsearchQueryBuilderOperatorLesserThanPlugin,\n ElasticsearchQueryBuilderOperatorNotBetweenPlugin,\n ElasticsearchQueryBuilderOperatorNotContainsPlugin,\n ElasticsearchQueryBuilderOperatorNotPlugin,\n ElasticsearchQueryBuilderOperatorNotInPlugin,\n ElasticsearchQueryBuilderOperatorEqualPlugin,\n ElasticsearchQueryBuilderOperatorStartsWithPlugin,\n ElasticsearchQueryBuilderOperatorNotStartsWithPlugin\n} from \"~/plugins/operator/index.js\";\n\nconst operators = [\n new ElasticsearchQueryBuilderOperatorBetweenPlugin(),\n new ElasticsearchQueryBuilderOperatorNotBetweenPlugin(),\n new ElasticsearchQueryBuilderOperatorContainsPlugin(),\n new ElasticsearchQueryBuilderOperatorNotContainsPlugin(),\n new ElasticsearchQueryBuilderOperatorEqualPlugin(),\n new ElasticsearchQueryBuilderOperatorNotPlugin(),\n new ElasticsearchQueryBuilderOperatorGreaterThanPlugin(),\n new ElasticsearchQueryBuilderOperatorGreaterThanOrEqualToPlugin(),\n new ElasticsearchQueryBuilderOperatorLesserThanPlugin(),\n new ElasticsearchQueryBuilderOperatorLesserThanOrEqualToPlugin(),\n new ElasticsearchQueryBuilderOperatorInPlugin(),\n new ElasticsearchQueryBuilderOperatorAndInPlugin(),\n new ElasticsearchQueryBuilderOperatorNotInPlugin(),\n new ElasticsearchQueryBuilderOperatorStartsWithPlugin(),\n new ElasticsearchQueryBuilderOperatorNotStartsWithPlugin()\n];\n/**\n * We export as a function because there might be something to be sent to the operators at some point.\n * This way, we make it easier to upgrade.\n */\nexport const getElasticsearchOperators = () => operators;\n"],"mappings":"AAAA,SACIA,8CAA8C,EAC9CC,4CAA4C,EAC5CC,2DAA2D,EAC3DC,kDAAkD,EAClDC,+CAA+C,EAC/CC,0DAA0D,EAC1DC,yCAAyC,EACzCC,iDAAiD,EACjDC,iDAAiD,EACjDC,kDAAkD,EAClDC,0CAA0C,EAC1CC,4CAA4C,EAC5CC,4CAA4C,EAC5CC,iDAAiD,EACjDC,oDAAoD;AAGxD,MAAMC,SAAS,GAAG,CACd,IAAIf,8CAA8C,CAAC,CAAC,EACpD,IAAIQ,iDAAiD,CAAC,CAAC,EACvD,IAAIJ,+CAA+C,CAAC,CAAC,EACrD,IAAIK,kDAAkD,CAAC,CAAC,EACxD,IAAIG,4CAA4C,CAAC,CAAC,EAClD,IAAIF,0CAA0C,CAAC,CAAC,EAChD,IAAIP,kDAAkD,CAAC,CAAC,EACxD,IAAID,2DAA2D,CAAC,CAAC,EACjE,IAAIK,iDAAiD,CAAC,CAAC,EACvD,IAAIF,0DAA0D,CAAC,CAAC,EAChE,IAAIC,yCAAyC,CAAC,CAAC,EAC/C,IAAIL,4CAA4C,CAAC,CAAC,EAClD,IAAIU,4CAA4C,CAAC,CAAC,EAClD,IAAIE,iDAAiD,CAAC,CAAC,EACvD,IAAIC,oDAAoD,CAAC,CAAC,CAC7D;AACD;AACA;AACA;AACA;AACA,OAAO,MAAME,yBAAyB,GAAGA,CAAA,KAAMD,SAAS","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-elasticsearch",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
3
|
+
"version": "0.0.0-unstable.f6dc066313",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"repository": {
|
|
5
6
|
"type": "git",
|
|
6
7
|
"url": "https://github.com/webiny/webiny-js.git",
|
|
@@ -13,24 +14,24 @@
|
|
|
13
14
|
"license": "MIT",
|
|
14
15
|
"dependencies": {
|
|
15
16
|
"@elastic/elasticsearch": "7.12.0",
|
|
16
|
-
"@webiny/api": "0.0.0-unstable.
|
|
17
|
-
"@webiny/
|
|
18
|
-
"@webiny/
|
|
17
|
+
"@webiny/api": "0.0.0-unstable.f6dc066313",
|
|
18
|
+
"@webiny/aws-sdk": "0.0.0-unstable.f6dc066313",
|
|
19
|
+
"@webiny/db-dynamodb": "0.0.0-unstable.f6dc066313",
|
|
20
|
+
"@webiny/error": "0.0.0-unstable.f6dc066313",
|
|
21
|
+
"@webiny/plugins": "0.0.0-unstable.f6dc066313",
|
|
19
22
|
"aws-elasticsearch-connector": "9.2.0",
|
|
20
23
|
"elastic-ts": "0.12.0"
|
|
21
24
|
},
|
|
22
25
|
"devDependencies": {
|
|
23
|
-
"@webiny/
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
+
"@webiny/build-tools": "0.0.0-unstable.f6dc066313",
|
|
27
|
+
"@webiny/project-utils": "0.0.0-unstable.f6dc066313",
|
|
28
|
+
"rimraf": "6.1.3",
|
|
29
|
+
"typescript": "5.9.3",
|
|
30
|
+
"vitest": "4.0.18"
|
|
26
31
|
},
|
|
27
32
|
"publishConfig": {
|
|
28
33
|
"access": "public",
|
|
29
34
|
"directory": "dist"
|
|
30
35
|
},
|
|
31
|
-
"
|
|
32
|
-
"build": "node ../cli/bin.js run build",
|
|
33
|
-
"watch": "node ../cli/bin.js run watch"
|
|
34
|
-
},
|
|
35
|
-
"gitHead": "eb196ccd2f32296e10f7add6dd7220d4e3abece4"
|
|
36
|
+
"gitHead": "f6dc066313ddce5339d2aacec3aa84e61232689b"
|
|
36
37
|
}
|
|
@@ -1,26 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.ElasticsearchBodyModifierPlugin = void 0;
|
|
8
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
-
var _plugins = require("@webiny/plugins");
|
|
10
|
-
class ElasticsearchBodyModifierPlugin extends _plugins.Plugin {
|
|
1
|
+
import WebinyError from "@webiny/error";
|
|
2
|
+
import { Plugin } from "@webiny/plugins";
|
|
3
|
+
export class ElasticsearchBodyModifierPlugin extends Plugin {
|
|
11
4
|
constructor(callable) {
|
|
12
5
|
super();
|
|
13
6
|
this.callable = callable;
|
|
14
7
|
}
|
|
15
8
|
modifyBody(params) {
|
|
16
9
|
if (typeof this.callable !== "function") {
|
|
17
|
-
throw new
|
|
10
|
+
throw new WebinyError(`Missing modification for the body.`, "BODY_MODIFICATION_MISSING", {
|
|
18
11
|
params
|
|
19
12
|
});
|
|
20
13
|
}
|
|
21
14
|
this.callable(params);
|
|
22
15
|
}
|
|
23
16
|
}
|
|
24
|
-
exports.ElasticsearchBodyModifierPlugin = ElasticsearchBodyModifierPlugin;
|
|
25
17
|
|
|
26
18
|
//# sourceMappingURL=ElasticsearchBodyModifierPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["WebinyError","Plugin","ElasticsearchBodyModifierPlugin","constructor","callable","modifyBody","params"],"sources":["ElasticsearchBodyModifierPlugin.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { Plugin } from \"@webiny/plugins\";\nimport type { SearchBody } from \"elastic-ts\";\n\nexport interface ModifyBodyParams {\n body: SearchBody;\n}\n\nexport interface ModifyBodyCallable<T extends ModifyBodyParams> {\n (params: T): void;\n}\n\nexport abstract class ElasticsearchBodyModifierPlugin<\n T extends ModifyBodyParams = ModifyBodyParams\n> extends Plugin {\n private readonly callable?: ModifyBodyCallable<T>;\n\n public constructor(callable?: ModifyBodyCallable<T>) {\n super();\n this.callable = callable;\n }\n\n public modifyBody(params: T): void {\n if (typeof this.callable !== \"function\") {\n throw new WebinyError(\n `Missing modification for the body.`,\n \"BODY_MODIFICATION_MISSING\",\n {\n params\n }\n );\n }\n this.callable(params);\n }\n}\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,MAAM,QAAQ,iBAAiB;AAWxC,OAAO,MAAeC,+BAA+B,SAE3CD,MAAM,CAAC;EAGNE,WAAWA,CAACC,QAAgC,EAAE;IACjD,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,QAAQ,GAAGA,QAAQ;EAC5B;EAEOC,UAAUA,CAACC,MAAS,EAAQ;IAC/B,IAAI,OAAO,IAAI,CAACF,QAAQ,KAAK,UAAU,EAAE;MACrC,MAAM,IAAIJ,WAAW,CACjB,oCAAoC,EACpC,2BAA2B,EAC3B;QACIM;MACJ,CACJ,CAAC;IACL;IACA,IAAI,CAACF,QAAQ,CAACE,MAAM,CAAC;EACzB;AACJ","ignoreList":[]}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ElasticsearchFieldPlugin = void 0;
|
|
7
|
-
var _plugins = require("@webiny/plugins");
|
|
1
|
+
import { Plugin } from "@webiny/plugins";
|
|
8
2
|
const keywordLessUnmappedType = ["date", "long"];
|
|
9
3
|
const unmappedTypeHasKeyword = type => {
|
|
10
4
|
if (!type) {
|
|
@@ -14,7 +8,7 @@ const unmappedTypeHasKeyword = type => {
|
|
|
14
8
|
}
|
|
15
9
|
return true;
|
|
16
10
|
};
|
|
17
|
-
class ElasticsearchFieldPlugin extends
|
|
11
|
+
export class ElasticsearchFieldPlugin extends Plugin {
|
|
18
12
|
static type = "elasticsearch.fieldDefinition";
|
|
19
13
|
static ALL = "*";
|
|
20
14
|
constructor(params) {
|
|
@@ -70,6 +64,5 @@ class ElasticsearchFieldPlugin extends _plugins.Plugin {
|
|
|
70
64
|
return params.value;
|
|
71
65
|
}
|
|
72
66
|
}
|
|
73
|
-
exports.ElasticsearchFieldPlugin = ElasticsearchFieldPlugin;
|
|
74
67
|
|
|
75
68
|
//# sourceMappingURL=ElasticsearchFieldPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["Plugin","keywordLessUnmappedType","unmappedTypeHasKeyword","type","includes","ElasticsearchFieldPlugin","ALL","constructor","params","field","path","keyword","undefined","unmappedType","sortable","searchable","getSortOptions","order","options","unmapped_type","getPath","getBasePath","toSearchValue","value"],"sources":["ElasticsearchFieldPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { FieldSortOptions, SortOrder } from \"elastic-ts\";\n\nexport type UnmappedTypes = \"date\" | \"long\" | string;\n\nconst keywordLessUnmappedType = [\"date\", \"long\"];\n\nconst unmappedTypeHasKeyword = (type?: string): boolean => {\n if (!type) {\n return true;\n } else if (keywordLessUnmappedType.includes(type)) {\n return false;\n }\n return true;\n};\n\nexport interface ToSearchValueParams {\n /**\n * The value to transform.\n */\n value: any;\n /**\n * When using toSearchValue() in our code we send a field.getPath() value here.\n */\n path: string;\n /**\n * When using toSearchValue() in our code we send a field.getBasePath() value here.\n */\n basePath: string;\n}\nexport interface ElasticsearchFieldPluginParams {\n /**\n * Which field is this plugin for.\n */\n field: string;\n /**\n * Some specific path of a field?\n * Example: createdBy is createdBy.id\n */\n path?: string;\n /**\n * Add a .keyword at the end of the field path?\n */\n keyword?: boolean;\n /**\n * Is the field of a specific type, but possibly not mapped?\n * Happens when inserting a date in string format.\n * You need to cast it as date when running the search/sort to work correctly.\n */\n unmappedType?: UnmappedTypes;\n /**\n * Is the field sortable?\n */\n sortable?: boolean;\n /**\n * Is the field searchable?\n */\n searchable?: boolean;\n /**\n * Used to transform the input value for the search.\n */\n toSearchValue?: (params: ToSearchValueParams) => any;\n}\n\nexport class ElasticsearchFieldPlugin extends Plugin {\n public static override readonly type: string = \"elasticsearch.fieldDefinition\";\n public static readonly ALL: string = \"*\";\n\n public readonly field: string;\n public readonly path: string;\n public readonly keyword: boolean;\n public readonly unmappedType?: string;\n public readonly sortable: boolean;\n public readonly searchable: boolean;\n\n constructor(params: ElasticsearchFieldPluginParams) {\n super();\n this.field = params.field;\n this.path = params.path || params.field;\n this.keyword = params.keyword === undefined ? true : params.keyword;\n this.unmappedType = params.unmappedType;\n if (unmappedTypeHasKeyword(params.unmappedType) === false) {\n this.keyword = false;\n }\n this.sortable = params.sortable === undefined ? true : params.sortable;\n this.searchable = params.searchable === undefined ? true : params.searchable;\n }\n /**\n * The default sort options. Extend in your own plugin if you want to add more options.\n */\n public getSortOptions(order: SortOrder): FieldSortOptions {\n const options = {\n order\n };\n if (!this.unmappedType) {\n return options;\n }\n return {\n ...options,\n unmapped_type: this.unmappedType\n };\n }\n /**\n * The default path generator. Extend in your own plugin if you want to add more options.\n * Field parameter is here because there is a possibility that this is the ALL field plugin, so we need to know which field are we working on.\n */\n public getPath(field: string): string {\n return `${this.getBasePath(field)}${this.keyword ? \".keyword\" : \"\"}`;\n }\n /**\n * @see getPath\n *\n * This is the default base path generator. Basically it replaces ALL with given field name.\n */\n public getBasePath(field: string): string {\n if (this.path === ElasticsearchFieldPlugin.ALL) {\n return field;\n }\n return this.path;\n }\n /**\n * The default transformer. Just returns the value by default.\n * Override to implement what ever is required.\n */\n public toSearchValue(params: ToSearchValueParams): any {\n return params.value;\n }\n}\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,iBAAiB;AAKxC,MAAMC,uBAAuB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;AAEhD,MAAMC,sBAAsB,GAAIC,IAAa,IAAc;EACvD,IAAI,CAACA,IAAI,EAAE;IACP,OAAO,IAAI;EACf,CAAC,MAAM,IAAIF,uBAAuB,CAACG,QAAQ,CAACD,IAAI,CAAC,EAAE;IAC/C,OAAO,KAAK;EAChB;EACA,OAAO,IAAI;AACf,CAAC;AAkDD,OAAO,MAAME,wBAAwB,SAASL,MAAM,CAAC;EACjD,OAAgCG,IAAI,GAAW,+BAA+B;EAC9E,OAAuBG,GAAG,GAAW,GAAG;EASxCC,WAAWA,CAACC,MAAsC,EAAE;IAChD,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,KAAK,GAAGD,MAAM,CAACC,KAAK;IACzB,IAAI,CAACC,IAAI,GAAGF,MAAM,CAACE,IAAI,IAAIF,MAAM,CAACC,KAAK;IACvC,IAAI,CAACE,OAAO,GAAGH,MAAM,CAACG,OAAO,KAAKC,SAAS,GAAG,IAAI,GAAGJ,MAAM,CAACG,OAAO;IACnE,IAAI,CAACE,YAAY,GAAGL,MAAM,CAACK,YAAY;IACvC,IAAIX,sBAAsB,CAACM,MAAM,CAACK,YAAY,CAAC,KAAK,KAAK,EAAE;MACvD,IAAI,CAACF,OAAO,GAAG,KAAK;IACxB;IACA,IAAI,CAACG,QAAQ,GAAGN,MAAM,CAACM,QAAQ,KAAKF,SAAS,GAAG,IAAI,GAAGJ,MAAM,CAACM,QAAQ;IACtE,IAAI,CAACC,UAAU,GAAGP,MAAM,CAACO,UAAU,KAAKH,SAAS,GAAG,IAAI,GAAGJ,MAAM,CAACO,UAAU;EAChF;EACA;AACJ;AACA;EACWC,cAAcA,CAACC,KAAgB,EAAoB;IACtD,MAAMC,OAAO,GAAG;MACZD;IACJ,CAAC;IACD,IAAI,CAAC,IAAI,CAACJ,YAAY,EAAE;MACpB,OAAOK,OAAO;IAClB;IACA,OAAO;MACH,GAAGA,OAAO;MACVC,aAAa,EAAE,IAAI,CAACN;IACxB,CAAC;EACL;EACA;AACJ;AACA;AACA;EACWO,OAAOA,CAACX,KAAa,EAAU;IAClC,OAAO,GAAG,IAAI,CAACY,WAAW,CAACZ,KAAK,CAAC,GAAG,IAAI,CAACE,OAAO,GAAG,UAAU,GAAG,EAAE,EAAE;EACxE;EACA;AACJ;AACA;AACA;AACA;EACWU,WAAWA,CAACZ,KAAa,EAAU;IACtC,IAAI,IAAI,CAACC,IAAI,KAAKL,wBAAwB,CAACC,GAAG,EAAE;MAC5C,OAAOG,KAAK;IAChB;IACA,OAAO,IAAI,CAACC,IAAI;EACpB;EACA;AACJ;AACA;AACA;EACWY,aAAaA,CAACd,MAA2B,EAAO;IACnD,OAAOA,MAAM,CAACe,KAAK;EACvB;AACJ","ignoreList":[]}
|
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import { Plugin } from "@webiny/plugins";
|
|
2
|
-
import type { ElasticsearchIndexRequestBody } from "../../types";
|
|
2
|
+
import type { ElasticsearchIndexRequestBody } from "../../types.js";
|
|
3
3
|
export interface ElasticsearchIndexPluginParams {
|
|
4
|
-
/**
|
|
5
|
-
* For which locales are we applying this plugin.
|
|
6
|
-
* Options:
|
|
7
|
-
* - locale codes to target specific locale
|
|
8
|
-
* - null for all
|
|
9
|
-
*/
|
|
10
|
-
locales?: string[];
|
|
11
4
|
body: ElasticsearchIndexRequestBody;
|
|
12
5
|
}
|
|
13
6
|
export declare abstract class ElasticsearchIndexPlugin extends Plugin {
|
|
14
7
|
readonly body: ElasticsearchIndexRequestBody;
|
|
15
|
-
private readonly locales;
|
|
16
8
|
constructor(params: ElasticsearchIndexPluginParams);
|
|
17
|
-
canUse(
|
|
9
|
+
canUse(): boolean;
|
|
18
10
|
}
|
|
@@ -1,36 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.ElasticsearchIndexPlugin = void 0;
|
|
8
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
-
var _plugins = require("@webiny/plugins");
|
|
10
|
-
class ElasticsearchIndexPlugin extends _plugins.Plugin {
|
|
1
|
+
import { Plugin } from "@webiny/plugins";
|
|
2
|
+
export class ElasticsearchIndexPlugin extends Plugin {
|
|
11
3
|
constructor(params) {
|
|
12
4
|
super();
|
|
13
5
|
const {
|
|
14
|
-
locales,
|
|
15
6
|
body
|
|
16
7
|
} = params;
|
|
17
8
|
this.body = {
|
|
18
9
|
...body
|
|
19
10
|
};
|
|
20
|
-
this.locales = locales ? locales.map(locale => locale.toLowerCase()) : undefined;
|
|
21
11
|
}
|
|
22
|
-
canUse(
|
|
23
|
-
|
|
24
|
-
return true;
|
|
25
|
-
} else if (this.locales.length === 0) {
|
|
26
|
-
throw new _error.default("Cannot have Elasticsearch Index Template plugin with no locales defined.", "LOCALES_ERROR", {
|
|
27
|
-
body: this.body,
|
|
28
|
-
locales: this.locales
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
return this.locales.includes(locale.toLowerCase());
|
|
12
|
+
canUse() {
|
|
13
|
+
return true;
|
|
32
14
|
}
|
|
33
15
|
}
|
|
34
|
-
exports.ElasticsearchIndexPlugin = ElasticsearchIndexPlugin;
|
|
35
16
|
|
|
36
17
|
//# sourceMappingURL=ElasticsearchIndexPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["Plugin","ElasticsearchIndexPlugin","constructor","params","body","canUse"],"sources":["ElasticsearchIndexPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { ElasticsearchIndexRequestBody } from \"~/types.js\";\n\nexport interface ElasticsearchIndexPluginParams {\n body: ElasticsearchIndexRequestBody;\n}\n\nexport abstract class ElasticsearchIndexPlugin extends Plugin {\n public readonly body: ElasticsearchIndexRequestBody;\n\n public constructor(params: ElasticsearchIndexPluginParams) {\n super();\n const { body } = params;\n this.body = {\n ...body\n };\n }\n\n public canUse(): boolean {\n return true;\n }\n}\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,iBAAiB;AAOxC,OAAO,MAAeC,wBAAwB,SAASD,MAAM,CAAC;EAGnDE,WAAWA,CAACC,MAAsC,EAAE;IACvD,KAAK,CAAC,CAAC;IACP,MAAM;MAAEC;IAAK,CAAC,GAAGD,MAAM;IACvB,IAAI,CAACC,IAAI,GAAG;MACR,GAAGA;IACP,CAAC;EACL;EAEOC,MAAMA,CAAA,EAAY;IACrB,OAAO,IAAI;EACf;AACJ","ignoreList":[]}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { Plugin } from "@webiny/plugins";
|
|
2
|
-
import type { ElasticsearchBoolQueryConfig, ElasticsearchQueryBuilderArgsPlugin } from "../../types";
|
|
2
|
+
import type { ElasticsearchBoolQueryConfig, ElasticsearchQueryBuilderArgsPlugin } from "../../types.js";
|
|
3
3
|
/**
|
|
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
7
|
static readonly type: string;
|
|
8
|
-
/**
|
|
9
|
-
* Check if current locale is supported by this plugin.
|
|
10
|
-
*/
|
|
11
|
-
isLocaleSupported(_: string): boolean;
|
|
12
8
|
abstract getOperator(): string;
|
|
13
9
|
abstract apply(query: ElasticsearchBoolQueryConfig, params: ElasticsearchQueryBuilderArgsPlugin): void;
|
|
14
10
|
}
|
|
@@ -1,24 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ElasticsearchQueryBuilderOperatorPlugin = void 0;
|
|
7
|
-
var _plugins = require("@webiny/plugins");
|
|
1
|
+
import { Plugin } from "@webiny/plugins";
|
|
8
2
|
/**
|
|
9
3
|
* Built-in operators name ends with .default because user can override the operator, just write a name without the .default keyword.
|
|
10
4
|
*/
|
|
11
|
-
class ElasticsearchQueryBuilderOperatorPlugin extends
|
|
5
|
+
export class ElasticsearchQueryBuilderOperatorPlugin extends Plugin {
|
|
12
6
|
static type = "elasticsearch.queryBuilder.operator";
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Check if current locale is supported by this plugin.
|
|
16
|
-
*/
|
|
17
|
-
// eslint-disable-next-line
|
|
18
|
-
isLocaleSupported(_) {
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
7
|
}
|
|
22
|
-
exports.ElasticsearchQueryBuilderOperatorPlugin = ElasticsearchQueryBuilderOperatorPlugin;
|
|
23
8
|
|
|
24
9
|
//# sourceMappingURL=ElasticsearchQueryBuilderOperatorPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["Plugin","ElasticsearchQueryBuilderOperatorPlugin","type"],"sources":["ElasticsearchQueryBuilderOperatorPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { ElasticsearchBoolQueryConfig, ElasticsearchQueryBuilderArgsPlugin } from \"~/types.js\";\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 public abstract getOperator(): string;\n\n public abstract apply(\n query: ElasticsearchBoolQueryConfig,\n params: ElasticsearchQueryBuilderArgsPlugin\n ): void;\n}\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,iBAAiB;AAGxC;AACA;AACA;AACA,OAAO,MAAeC,uCAAuC,SAASD,MAAM,CAAC;EACzE,OAAgCE,IAAI,GAAW,qCAAqC;AAQxF","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Plugin } from "@webiny/plugins";
|
|
2
|
-
import type { ElasticsearchBoolQueryConfig } from "../../types";
|
|
2
|
+
import type { ElasticsearchBoolQueryConfig } from "../../types.js";
|
|
3
3
|
export interface ModifyQueryParams {
|
|
4
4
|
query: ElasticsearchBoolQueryConfig;
|
|
5
5
|
where: Record<string, any>;
|
|
@@ -1,26 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.ElasticsearchQueryModifierPlugin = void 0;
|
|
8
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
-
var _plugins = require("@webiny/plugins");
|
|
10
|
-
class ElasticsearchQueryModifierPlugin extends _plugins.Plugin {
|
|
1
|
+
import WebinyError from "@webiny/error";
|
|
2
|
+
import { Plugin } from "@webiny/plugins";
|
|
3
|
+
export class ElasticsearchQueryModifierPlugin extends Plugin {
|
|
11
4
|
constructor(callable) {
|
|
12
5
|
super();
|
|
13
6
|
this.callable = callable;
|
|
14
7
|
}
|
|
15
8
|
modifyQuery(params) {
|
|
16
9
|
if (typeof this.callable !== "function") {
|
|
17
|
-
throw new
|
|
10
|
+
throw new WebinyError(`Missing modification for the query.`, "QUERY_MODIFICATION_MISSING", {
|
|
18
11
|
params
|
|
19
12
|
});
|
|
20
13
|
}
|
|
21
14
|
this.callable(params);
|
|
22
15
|
}
|
|
23
16
|
}
|
|
24
|
-
exports.ElasticsearchQueryModifierPlugin = ElasticsearchQueryModifierPlugin;
|
|
25
17
|
|
|
26
18
|
//# sourceMappingURL=ElasticsearchQueryModifierPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["WebinyError","Plugin","ElasticsearchQueryModifierPlugin","constructor","callable","modifyQuery","params"],"sources":["ElasticsearchQueryModifierPlugin.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { Plugin } from \"@webiny/plugins\";\nimport type { ElasticsearchBoolQueryConfig } from \"~/types.js\";\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,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,MAAM,QAAQ,iBAAiB;AAYxC,OAAO,MAAeC,gCAAgC,SAE5CD,MAAM,CAAC;EAGNE,WAAWA,CAACC,QAAiC,EAAE;IAClD,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,QAAQ,GAAGA,QAAQ;EAC5B;EAEOC,WAAWA,CAACC,MAAS,EAAQ;IAChC,IAAI,OAAO,IAAI,CAACF,QAAQ,KAAK,UAAU,EAAE;MACrC,MAAM,IAAIJ,WAAW,CACjB,qCAAqC,EACrC,4BAA4B,EAC5B;QACIM;MACJ,CACJ,CAAC;IACL;IACA,IAAI,CAACF,QAAQ,CAACE,MAAM,CAAC;EACzB;AACJ","ignoreList":[]}
|
|
@@ -1,26 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.ElasticsearchSortModifierPlugin = void 0;
|
|
8
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
-
var _plugins = require("@webiny/plugins");
|
|
10
|
-
class ElasticsearchSortModifierPlugin extends _plugins.Plugin {
|
|
1
|
+
import WebinyError from "@webiny/error";
|
|
2
|
+
import { Plugin } from "@webiny/plugins";
|
|
3
|
+
export class ElasticsearchSortModifierPlugin extends Plugin {
|
|
11
4
|
constructor(callable) {
|
|
12
5
|
super();
|
|
13
6
|
this.callable = callable;
|
|
14
7
|
}
|
|
15
8
|
modifySort(params) {
|
|
16
9
|
if (typeof this.callable !== "function") {
|
|
17
|
-
throw new
|
|
10
|
+
throw new WebinyError(`Missing modification for the sort.`, "SORT_MODIFICATION_MISSING", {
|
|
18
11
|
params
|
|
19
12
|
});
|
|
20
13
|
}
|
|
21
14
|
this.callable(params);
|
|
22
15
|
}
|
|
23
16
|
}
|
|
24
|
-
exports.ElasticsearchSortModifierPlugin = ElasticsearchSortModifierPlugin;
|
|
25
17
|
|
|
26
18
|
//# sourceMappingURL=ElasticsearchSortModifierPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["WebinyError","Plugin","ElasticsearchSortModifierPlugin","constructor","callable","modifySort","params"],"sources":["ElasticsearchSortModifierPlugin.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { Plugin } from \"@webiny/plugins\";\nimport type { 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,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,MAAM,QAAQ,iBAAiB;AAWxC,OAAO,MAAeC,+BAA+B,SAE3CD,MAAM,CAAC;EAGNE,WAAWA,CAACC,QAAgC,EAAE;IACjD,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,QAAQ,GAAGA,QAAQ;EAC5B;EAEOC,UAAUA,CAACC,MAAS,EAAQ;IAC/B,IAAI,OAAO,IAAI,CAACF,QAAQ,KAAK,UAAU,EAAE;MACrC,MAAM,IAAIJ,WAAW,CACjB,oCAAoC,EACpC,2BAA2B,EAC3B;QACIM;MACJ,CACJ,CAAC;IACL;IACA,IAAI,CAACF,QAAQ,CAACE,MAAM,CAAC;EACzB;AACJ","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from "./ElasticsearchBodyModifierPlugin";
|
|
2
|
-
export * from "./ElasticsearchFieldPlugin";
|
|
3
|
-
export * from "./ElasticsearchIndexPlugin";
|
|
4
|
-
export * from "./ElasticsearchQueryBuilderOperatorPlugin";
|
|
5
|
-
export * from "./ElasticsearchQueryModifierPlugin";
|
|
6
|
-
export * from "./ElasticsearchSortModifierPlugin";
|
|
1
|
+
export * from "./ElasticsearchBodyModifierPlugin.js";
|
|
2
|
+
export * from "./ElasticsearchFieldPlugin.js";
|
|
3
|
+
export * from "./ElasticsearchIndexPlugin.js";
|
|
4
|
+
export * from "./ElasticsearchQueryBuilderOperatorPlugin.js";
|
|
5
|
+
export * from "./ElasticsearchQueryModifierPlugin.js";
|
|
6
|
+
export * from "./ElasticsearchSortModifierPlugin.js";
|
|
@@ -1,73 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Object.keys(_ElasticsearchBodyModifierPlugin).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _ElasticsearchBodyModifierPlugin[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _ElasticsearchBodyModifierPlugin[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _ElasticsearchFieldPlugin = require("./ElasticsearchFieldPlugin");
|
|
18
|
-
Object.keys(_ElasticsearchFieldPlugin).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _ElasticsearchFieldPlugin[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _ElasticsearchFieldPlugin[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
var _ElasticsearchIndexPlugin = require("./ElasticsearchIndexPlugin");
|
|
29
|
-
Object.keys(_ElasticsearchIndexPlugin).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in exports && exports[key] === _ElasticsearchIndexPlugin[key]) return;
|
|
32
|
-
Object.defineProperty(exports, key, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () {
|
|
35
|
-
return _ElasticsearchIndexPlugin[key];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
var _ElasticsearchQueryBuilderOperatorPlugin = require("./ElasticsearchQueryBuilderOperatorPlugin");
|
|
40
|
-
Object.keys(_ElasticsearchQueryBuilderOperatorPlugin).forEach(function (key) {
|
|
41
|
-
if (key === "default" || key === "__esModule") return;
|
|
42
|
-
if (key in exports && exports[key] === _ElasticsearchQueryBuilderOperatorPlugin[key]) return;
|
|
43
|
-
Object.defineProperty(exports, key, {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
get: function () {
|
|
46
|
-
return _ElasticsearchQueryBuilderOperatorPlugin[key];
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
var _ElasticsearchQueryModifierPlugin = require("./ElasticsearchQueryModifierPlugin");
|
|
51
|
-
Object.keys(_ElasticsearchQueryModifierPlugin).forEach(function (key) {
|
|
52
|
-
if (key === "default" || key === "__esModule") return;
|
|
53
|
-
if (key in exports && exports[key] === _ElasticsearchQueryModifierPlugin[key]) return;
|
|
54
|
-
Object.defineProperty(exports, key, {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
get: function () {
|
|
57
|
-
return _ElasticsearchQueryModifierPlugin[key];
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
var _ElasticsearchSortModifierPlugin = require("./ElasticsearchSortModifierPlugin");
|
|
62
|
-
Object.keys(_ElasticsearchSortModifierPlugin).forEach(function (key) {
|
|
63
|
-
if (key === "default" || key === "__esModule") return;
|
|
64
|
-
if (key in exports && exports[key] === _ElasticsearchSortModifierPlugin[key]) return;
|
|
65
|
-
Object.defineProperty(exports, key, {
|
|
66
|
-
enumerable: true,
|
|
67
|
-
get: function () {
|
|
68
|
-
return _ElasticsearchSortModifierPlugin[key];
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
});
|
|
1
|
+
export * from "./ElasticsearchBodyModifierPlugin.js";
|
|
2
|
+
export * from "./ElasticsearchFieldPlugin.js";
|
|
3
|
+
export * from "./ElasticsearchIndexPlugin.js";
|
|
4
|
+
export * from "./ElasticsearchQueryBuilderOperatorPlugin.js";
|
|
5
|
+
export * from "./ElasticsearchQueryModifierPlugin.js";
|
|
6
|
+
export * from "./ElasticsearchSortModifierPlugin.js";
|
|
72
7
|
|
|
73
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./ElasticsearchBodyModifierPlugin.js\";\nexport * from \"./ElasticsearchFieldPlugin.js\";\nexport * from \"./ElasticsearchIndexPlugin.js\";\nexport * from \"./ElasticsearchQueryBuilderOperatorPlugin.js\";\nexport * from \"./ElasticsearchQueryModifierPlugin.js\";\nexport * from \"./ElasticsearchSortModifierPlugin.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
package/plugins/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./operator";
|
|
2
|
-
export * from "./definition";
|
|
1
|
+
export * from "./operator/index.js";
|
|
2
|
+
export * from "./definition/index.js";
|