@webiny/api-elasticsearch 0.0.0-unstable.611c5af35e → 0.0.0-unstable.615a930a68
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 +16 -4
- package/client.js.map +1 -1
- package/compression.js +17 -0
- package/compression.js.map +1 -1
- package/cursors.d.ts +2 -1
- package/cursors.js +17 -1
- package/cursors.js.map +1 -1
- package/index.js +32 -0
- package/index.js.map +1 -1
- package/indexConfiguration/base.js +5 -0
- package/indexConfiguration/base.js.map +1 -1
- package/indexConfiguration/common.js +4 -0
- package/indexConfiguration/common.js.map +1 -1
- package/indexConfiguration/index.js +6 -0
- package/indexConfiguration/index.js.map +1 -1
- package/indexConfiguration/japanese.js +5 -0
- package/indexConfiguration/japanese.js.map +1 -1
- package/indices.js +7 -0
- package/indices.js.map +1 -1
- package/limit.js +8 -0
- package/limit.js.map +1 -1
- package/normalize.js +7 -6
- package/normalize.js.map +1 -1
- package/operators.js +11 -0
- package/operators.js.map +1 -1
- package/package.json +9 -9
- package/plugins/GzipCompression.js +18 -0
- package/plugins/GzipCompression.js.map +1 -1
- package/plugins/definition/CompressionPlugin.js +5 -0
- package/plugins/definition/CompressionPlugin.js.map +1 -1
- package/plugins/definition/ElasticsearchBodyModifierPlugin.js +9 -0
- package/plugins/definition/ElasticsearchBodyModifierPlugin.js.map +1 -1
- package/plugins/definition/ElasticsearchFieldPlugin.js +23 -0
- package/plugins/definition/ElasticsearchFieldPlugin.js.map +1 -1
- package/plugins/definition/ElasticsearchIndexPlugin.js +10 -0
- package/plugins/definition/ElasticsearchIndexPlugin.js.map +1 -1
- package/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.js +6 -0
- package/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.js.map +1 -1
- package/plugins/definition/ElasticsearchQueryModifierPlugin.js +9 -0
- package/plugins/definition/ElasticsearchQueryModifierPlugin.js.map +1 -1
- package/plugins/definition/ElasticsearchSortModifierPlugin.js +9 -0
- package/plugins/definition/ElasticsearchSortModifierPlugin.js.map +1 -1
- package/plugins/definition/index.js +14 -0
- package/plugins/definition/index.js.map +1 -1
- package/plugins/index.js +4 -0
- package/plugins/index.js.map +1 -1
- package/plugins/operator/andIn.js +14 -3
- package/plugins/operator/andIn.js.map +1 -1
- package/plugins/operator/between.js +17 -6
- package/plugins/operator/between.js.map +1 -1
- package/plugins/operator/contains.js +9 -0
- package/plugins/operator/contains.js.map +1 -1
- package/plugins/operator/equal.js +34 -4
- package/plugins/operator/equal.js.map +1 -1
- package/plugins/operator/gt.js +9 -1
- package/plugins/operator/gt.js.map +1 -1
- package/plugins/operator/gte.js +9 -1
- package/plugins/operator/gte.js.map +1 -1
- package/plugins/operator/in.js +17 -12
- package/plugins/operator/in.js.map +1 -1
- package/plugins/operator/index.js +32 -0
- package/plugins/operator/index.js.map +1 -1
- package/plugins/operator/japanese/contains.js +11 -0
- package/plugins/operator/japanese/contains.js.map +1 -1
- package/plugins/operator/lt.js +9 -1
- package/plugins/operator/lt.js.map +1 -1
- package/plugins/operator/lte.js +9 -1
- package/plugins/operator/lte.js.map +1 -1
- package/plugins/operator/not.js +25 -3
- package/plugins/operator/not.js.map +1 -1
- package/plugins/operator/notBetween.js +16 -5
- package/plugins/operator/notBetween.js.map +1 -1
- package/plugins/operator/notContains.js +9 -0
- package/plugins/operator/notContains.js.map +1 -1
- package/plugins/operator/notIn.js +13 -2
- package/plugins/operator/notIn.js.map +1 -1
- package/plugins/operator/notStartsWith.js +8 -0
- package/plugins/operator/notStartsWith.js.map +1 -1
- package/plugins/operator/startsWith.js +9 -1
- package/plugins/operator/startsWith.js.map +1 -1
- package/sort.d.ts +2 -6
- package/sort.js +15 -2
- package/sort.js.map +1 -1
- package/types.d.ts +6 -3
- package/types.js +5 -2
- package/types.js.map +1 -1
- package/where.js +23 -1
- package/where.js.map +1 -1
package/client.js
CHANGED
|
@@ -1,32 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.createElasticsearchClient = void 0;
|
|
9
|
+
|
|
8
10
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
|
+
|
|
9
12
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
+
|
|
10
14
|
var _elasticsearch = require("@elastic/elasticsearch");
|
|
15
|
+
|
|
11
16
|
var _awsSdk = _interopRequireDefault(require("aws-sdk"));
|
|
17
|
+
|
|
12
18
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
19
|
+
|
|
13
20
|
var _awsElasticsearchConnector = _interopRequireDefault(require("aws-elasticsearch-connector"));
|
|
21
|
+
|
|
14
22
|
const _excluded = ["endpoint", "node"];
|
|
23
|
+
|
|
15
24
|
const createElasticsearchClient = options => {
|
|
16
25
|
const {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
26
|
+
endpoint,
|
|
27
|
+
node
|
|
28
|
+
} = options,
|
|
29
|
+
rest = (0, _objectWithoutProperties2.default)(options, _excluded);
|
|
21
30
|
const clientOptions = (0, _objectSpread2.default)({
|
|
22
31
|
node: endpoint || node
|
|
23
32
|
}, rest);
|
|
33
|
+
|
|
24
34
|
if (!clientOptions.auth) {
|
|
25
35
|
/**
|
|
26
36
|
* If no `auth` configuration is present, we setup AWS connector.
|
|
27
37
|
*/
|
|
28
38
|
Object.assign(clientOptions, (0, _awsElasticsearchConnector.default)(_awsSdk.default.config));
|
|
29
39
|
}
|
|
40
|
+
|
|
30
41
|
try {
|
|
31
42
|
return new _elasticsearch.Client(clientOptions);
|
|
32
43
|
} catch (ex) {
|
|
@@ -40,4 +51,5 @@ const createElasticsearchClient = options => {
|
|
|
40
51
|
throw new _error.default("Could not connect to Elasticsearch.", "ELASTICSEARCH_CLIENT_ERROR", data);
|
|
41
52
|
}
|
|
42
53
|
};
|
|
54
|
+
|
|
43
55
|
exports.createElasticsearchClient = createElasticsearchClient;
|
package/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createElasticsearchClient","options","endpoint","node","rest","clientOptions","auth","Object","assign","createAwsElasticsearchConnector","AWS","config","Client","ex","data","error","undefined","console","log","WebinyError"],"sources":["client.ts"],"sourcesContent":["import { Client, ClientOptions } from \"@elastic/elasticsearch\";\nimport AWS from \"aws-sdk\";\nimport WebinyError from \"@webiny/error\";\n/**\n * Package aws-elasticsearch-connector does not have types.\n */\n// @ts-ignore\nimport createAwsElasticsearchConnector from \"aws-elasticsearch-connector\";\n\nexport interface ElasticsearchClientOptions extends ClientOptions {\n endpoint?: string;\n}\n\nexport const createElasticsearchClient = (options: ElasticsearchClientOptions) => {\n const { endpoint, node, ...rest } = options;\n\n const clientOptions: ClientOptions = {\n node: endpoint || node,\n ...rest\n };\n\n if (!clientOptions.auth) {\n /**\n * If no `auth` configuration is present, we setup AWS connector.\n */\n Object.assign(clientOptions, createAwsElasticsearchConnector(AWS.config));\n }\n\n try {\n return new Client(clientOptions);\n } catch (ex) {\n const data = {\n error: ex,\n node: endpoint || node,\n ...rest,\n auth: undefined\n };\n console.log({\n ...data\n });\n throw new WebinyError(\n \"Could not connect to Elasticsearch.\",\n \"ELASTICSEARCH_CLIENT_ERROR\",\n data\n );\n }\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["createElasticsearchClient","options","endpoint","node","rest","clientOptions","auth","Object","assign","createAwsElasticsearchConnector","AWS","config","Client","ex","data","error","undefined","console","log","WebinyError"],"sources":["client.ts"],"sourcesContent":["import { Client, ClientOptions } from \"@elastic/elasticsearch\";\nimport AWS from \"aws-sdk\";\nimport WebinyError from \"@webiny/error\";\n/**\n * Package aws-elasticsearch-connector does not have types.\n */\n// @ts-ignore\nimport createAwsElasticsearchConnector from \"aws-elasticsearch-connector\";\n\nexport interface ElasticsearchClientOptions extends ClientOptions {\n endpoint?: string;\n}\n\nexport const createElasticsearchClient = (options: ElasticsearchClientOptions) => {\n const { endpoint, node, ...rest } = options;\n\n const clientOptions: ClientOptions = {\n node: endpoint || node,\n ...rest\n };\n\n if (!clientOptions.auth) {\n /**\n * If no `auth` configuration is present, we setup AWS connector.\n */\n Object.assign(clientOptions, createAwsElasticsearchConnector(AWS.config));\n }\n\n try {\n return new Client(clientOptions);\n } catch (ex) {\n const data = {\n error: ex,\n node: endpoint || node,\n ...rest,\n auth: undefined\n };\n console.log({\n ...data\n });\n throw new WebinyError(\n \"Could not connect to Elasticsearch.\",\n \"ELASTICSEARCH_CLIENT_ERROR\",\n data\n );\n }\n};\n"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAKA;;;;AAMO,MAAMA,yBAAyB,GAAIC,OAAD,IAAyC;EAC9E,MAAM;IAAEC,QAAF;IAAYC;EAAZ,IAA8BF,OAApC;EAAA,MAA2BG,IAA3B,0CAAoCH,OAApC;EAEA,MAAMI,aAA4B;IAC9BF,IAAI,EAAED,QAAQ,IAAIC;EADY,GAE3BC,IAF2B,CAAlC;;EAKA,IAAI,CAACC,aAAa,CAACC,IAAnB,EAAyB;IACrB;AACR;AACA;IACQC,MAAM,CAACC,MAAP,CAAcH,aAAd,EAA6B,IAAAI,kCAAA,EAAgCC,eAAA,CAAIC,MAApC,CAA7B;EACH;;EAED,IAAI;IACA,OAAO,IAAIC,qBAAJ,CAAWP,aAAX,CAAP;EACH,CAFD,CAEE,OAAOQ,EAAP,EAAW;IACT,MAAMC,IAAI;MACNC,KAAK,EAAEF,EADD;MAENV,IAAI,EAAED,QAAQ,IAAIC;IAFZ,GAGHC,IAHG;MAINE,IAAI,EAAEU;IAJA,EAAV;IAMAC,OAAO,CAACC,GAAR,iCACOJ,IADP;IAGA,MAAM,IAAIK,cAAJ,CACF,qCADE,EAEF,4BAFE,EAGFL,IAHE,CAAN;EAKH;AACJ,CAjCM"}
|
package/compression.js
CHANGED
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.decompress = exports.compress = void 0;
|
|
7
|
+
|
|
7
8
|
var _CompressionPlugin = require("./plugins/definition/CompressionPlugin");
|
|
9
|
+
|
|
8
10
|
/**
|
|
9
11
|
* Get the compression plugins, in reverse order, because we want to use the last one added - first.
|
|
10
12
|
*/
|
|
@@ -14,38 +16,53 @@ const getCompressionPlugins = plugins => {
|
|
|
14
16
|
/**
|
|
15
17
|
* Method to compress the elasticsearch data that is going to be stored into the DynamoDB table that is meant for elasticsearch.
|
|
16
18
|
*/
|
|
19
|
+
|
|
20
|
+
|
|
17
21
|
const compress = async (pluginsContainer, data) => {
|
|
18
22
|
const plugins = getCompressionPlugins(pluginsContainer);
|
|
23
|
+
|
|
19
24
|
if (plugins.length === 0) {
|
|
20
25
|
console.log("No compression plugins");
|
|
21
26
|
return data;
|
|
22
27
|
}
|
|
28
|
+
|
|
23
29
|
for (const plugin of plugins) {
|
|
24
30
|
if (plugin.canCompress(data) === false) {
|
|
25
31
|
continue;
|
|
26
32
|
}
|
|
33
|
+
|
|
27
34
|
return await plugin.compress(data);
|
|
28
35
|
}
|
|
29
36
|
/**
|
|
30
37
|
* Possibly no plugins that can compress, just return the data.
|
|
31
38
|
*/
|
|
39
|
+
|
|
40
|
+
|
|
32
41
|
return data;
|
|
33
42
|
};
|
|
43
|
+
|
|
34
44
|
exports.compress = compress;
|
|
45
|
+
|
|
35
46
|
const decompress = async (pluginsContainer, data) => {
|
|
36
47
|
const plugins = getCompressionPlugins(pluginsContainer);
|
|
48
|
+
|
|
37
49
|
if (plugins.length === 0) {
|
|
38
50
|
return data;
|
|
39
51
|
}
|
|
52
|
+
|
|
40
53
|
for (const plugin of plugins) {
|
|
41
54
|
if (plugin.canDecompress(data) === false) {
|
|
42
55
|
continue;
|
|
43
56
|
}
|
|
57
|
+
|
|
44
58
|
return await plugin.decompress(data);
|
|
45
59
|
}
|
|
46
60
|
/**
|
|
47
61
|
* Possibly no plugins that can decompress, just return the data.
|
|
48
62
|
*/
|
|
63
|
+
|
|
64
|
+
|
|
49
65
|
return data;
|
|
50
66
|
};
|
|
67
|
+
|
|
51
68
|
exports.decompress = decompress;
|
package/compression.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getCompressionPlugins","plugins","byType","CompressionPlugin","type","reverse","compress","pluginsContainer","data","length","console","log","plugin","canCompress","decompress","canDecompress"],"sources":["compression.ts"],"sourcesContent":["import { CompressionPlugin } from \"~/plugins/definition/CompressionPlugin\";\nimport { PluginsContainer } from \"@webiny/plugins\";\n\n/**\n * Get the compression plugins, in reverse order, because we want to use the last one added - first.\n */\nconst getCompressionPlugins = (plugins: PluginsContainer): CompressionPlugin[] => {\n return plugins.byType<CompressionPlugin>(CompressionPlugin.type).reverse();\n};\n/**\n * Method to compress the elasticsearch data that is going to be stored into the DynamoDB table that is meant for elasticsearch.\n */\nexport const compress = async (\n pluginsContainer: PluginsContainer,\n data: Record<string, any>\n): Promise<Record<string, any>> => {\n const plugins = getCompressionPlugins(pluginsContainer);\n if (plugins.length === 0) {\n console.log(\"No compression plugins\");\n return data;\n }\n for (const plugin of plugins) {\n if (plugin.canCompress(data) === false) {\n continue;\n }\n return await plugin.compress(data);\n }\n /**\n * Possibly no plugins that can compress, just return the data.\n */\n return data;\n};\n\nexport const decompress = async (\n pluginsContainer: PluginsContainer,\n data: Record<string, any>\n): Promise<Record<string, any>> => {\n const plugins = getCompressionPlugins(pluginsContainer);\n if (plugins.length === 0) {\n return data;\n }\n for (const plugin of plugins) {\n if (plugin.canDecompress(data) === false) {\n continue;\n }\n return await plugin.decompress(data);\n }\n /**\n * Possibly no plugins that can decompress, just return the data.\n */\n return data;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["getCompressionPlugins","plugins","byType","CompressionPlugin","type","reverse","compress","pluginsContainer","data","length","console","log","plugin","canCompress","decompress","canDecompress"],"sources":["compression.ts"],"sourcesContent":["import { CompressionPlugin } from \"~/plugins/definition/CompressionPlugin\";\nimport { PluginsContainer } from \"@webiny/plugins\";\n\n/**\n * Get the compression plugins, in reverse order, because we want to use the last one added - first.\n */\nconst getCompressionPlugins = (plugins: PluginsContainer): CompressionPlugin[] => {\n return plugins.byType<CompressionPlugin>(CompressionPlugin.type).reverse();\n};\n/**\n * Method to compress the elasticsearch data that is going to be stored into the DynamoDB table that is meant for elasticsearch.\n */\nexport const compress = async (\n pluginsContainer: PluginsContainer,\n data: Record<string, any>\n): Promise<Record<string, any>> => {\n const plugins = getCompressionPlugins(pluginsContainer);\n if (plugins.length === 0) {\n console.log(\"No compression plugins\");\n return data;\n }\n for (const plugin of plugins) {\n if (plugin.canCompress(data) === false) {\n continue;\n }\n return await plugin.compress(data);\n }\n /**\n * Possibly no plugins that can compress, just return the data.\n */\n return data;\n};\n\nexport const decompress = async (\n pluginsContainer: PluginsContainer,\n data: Record<string, any>\n): Promise<Record<string, any>> => {\n const plugins = getCompressionPlugins(pluginsContainer);\n if (plugins.length === 0) {\n return data;\n }\n for (const plugin of plugins) {\n if (plugin.canDecompress(data) === false) {\n continue;\n }\n return await plugin.decompress(data);\n }\n /**\n * Possibly no plugins that can decompress, just return the data.\n */\n return data;\n};\n"],"mappings":";;;;;;;AAAA;;AAGA;AACA;AACA;AACA,MAAMA,qBAAqB,GAAIC,OAAD,IAAoD;EAC9E,OAAOA,OAAO,CAACC,MAAR,CAAkCC,oCAAA,CAAkBC,IAApD,EAA0DC,OAA1D,EAAP;AACH,CAFD;AAGA;AACA;AACA;;;AACO,MAAMC,QAAQ,GAAG,OACpBC,gBADoB,EAEpBC,IAFoB,KAGW;EAC/B,MAAMP,OAAO,GAAGD,qBAAqB,CAACO,gBAAD,CAArC;;EACA,IAAIN,OAAO,CAACQ,MAAR,KAAmB,CAAvB,EAA0B;IACtBC,OAAO,CAACC,GAAR,CAAY,wBAAZ;IACA,OAAOH,IAAP;EACH;;EACD,KAAK,MAAMI,MAAX,IAAqBX,OAArB,EAA8B;IAC1B,IAAIW,MAAM,CAACC,WAAP,CAAmBL,IAAnB,MAA6B,KAAjC,EAAwC;MACpC;IACH;;IACD,OAAO,MAAMI,MAAM,CAACN,QAAP,CAAgBE,IAAhB,CAAb;EACH;EACD;AACJ;AACA;;;EACI,OAAOA,IAAP;AACH,CAnBM;;;;AAqBA,MAAMM,UAAU,GAAG,OACtBP,gBADsB,EAEtBC,IAFsB,KAGS;EAC/B,MAAMP,OAAO,GAAGD,qBAAqB,CAACO,gBAAD,CAArC;;EACA,IAAIN,OAAO,CAACQ,MAAR,KAAmB,CAAvB,EAA0B;IACtB,OAAOD,IAAP;EACH;;EACD,KAAK,MAAMI,MAAX,IAAqBX,OAArB,EAA8B;IAC1B,IAAIW,MAAM,CAACG,aAAP,CAAqBP,IAArB,MAA+B,KAAnC,EAA0C;MACtC;IACH;;IACD,OAAO,MAAMI,MAAM,CAACE,UAAP,CAAkBN,IAAlB,CAAb;EACH;EACD;AACJ;AACA;;;EACI,OAAOA,IAAP;AACH,CAlBM"}
|
package/cursors.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PrimitiveValue } from "./types";
|
|
1
2
|
/**
|
|
2
3
|
* Encode a received cursor value into something that can be passed on to the user.
|
|
3
4
|
*/
|
|
@@ -6,4 +7,4 @@ export declare const encodeCursor: (cursor?: string | string[] | null) => string
|
|
|
6
7
|
* Decode a received value into a Elasticsearch cursor.
|
|
7
8
|
* If no value is received or is not decodable, return undefined.
|
|
8
9
|
*/
|
|
9
|
-
export declare const decodeCursor: (cursor?: string | null) =>
|
|
10
|
+
export declare const decodeCursor: (cursor?: string | null) => PrimitiveValue[] | undefined;
|
package/cursors.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.encodeCursor = exports.decodeCursor = void 0;
|
|
7
|
+
|
|
7
8
|
/**
|
|
8
9
|
* Encode a received cursor value into something that can be passed on to the user.
|
|
9
10
|
*/
|
|
@@ -11,29 +12,44 @@ const encodeCursor = cursor => {
|
|
|
11
12
|
if (!cursor) {
|
|
12
13
|
return undefined;
|
|
13
14
|
}
|
|
15
|
+
|
|
14
16
|
cursor = Array.isArray(cursor) ? cursor.map(encodeURIComponent) : encodeURIComponent(cursor);
|
|
17
|
+
|
|
15
18
|
try {
|
|
16
19
|
return Buffer.from(JSON.stringify(cursor)).toString("base64");
|
|
17
20
|
} catch (ex) {
|
|
18
21
|
console.error(ex.message);
|
|
19
22
|
}
|
|
23
|
+
|
|
20
24
|
return undefined;
|
|
21
25
|
};
|
|
22
26
|
/**
|
|
23
27
|
* Decode a received value into a Elasticsearch cursor.
|
|
24
28
|
* If no value is received or is not decodable, return undefined.
|
|
25
29
|
*/
|
|
30
|
+
|
|
31
|
+
|
|
26
32
|
exports.encodeCursor = encodeCursor;
|
|
33
|
+
|
|
27
34
|
const decodeCursor = cursor => {
|
|
28
35
|
if (!cursor) {
|
|
29
36
|
return undefined;
|
|
30
37
|
}
|
|
38
|
+
|
|
31
39
|
try {
|
|
32
40
|
const value = JSON.parse(Buffer.from(cursor, "base64").toString("ascii"));
|
|
33
|
-
|
|
41
|
+
|
|
42
|
+
if (Array.isArray(value)) {
|
|
43
|
+
return value.map(decodeURIComponent);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const decoded = decodeURIComponent(value);
|
|
47
|
+
return decoded ? [decoded] : undefined;
|
|
34
48
|
} catch (ex) {
|
|
35
49
|
console.error(ex.message);
|
|
36
50
|
}
|
|
51
|
+
|
|
37
52
|
return undefined;
|
|
38
53
|
};
|
|
54
|
+
|
|
39
55
|
exports.decodeCursor = decodeCursor;
|
package/cursors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["encodeCursor","cursor","undefined","Array","isArray","map","encodeURIComponent","Buffer","from","JSON","stringify","toString","ex","console","error","message","decodeCursor","value","parse","decodeURIComponent"],"sources":["cursors.ts"],"sourcesContent":["/**\n * Encode a received cursor value into something that can be passed on to the user.\n */\nexport const encodeCursor = (cursor?: string | string[] | null): string | undefined => {\n if (!cursor) {\n return undefined;\n }\n\n cursor = Array.isArray(cursor) ? cursor.map(encodeURIComponent) : encodeURIComponent(cursor);\n\n try {\n return Buffer.from(JSON.stringify(cursor)).toString(\"base64\");\n } catch (ex) {\n console.error(ex.message);\n }\n return undefined;\n};\n/**\n * Decode a received value into a Elasticsearch cursor.\n * If no value is received or is not decodable, return undefined.\n */\nexport const decodeCursor = (cursor?: string | null):
|
|
1
|
+
{"version":3,"names":["encodeCursor","cursor","undefined","Array","isArray","map","encodeURIComponent","Buffer","from","JSON","stringify","toString","ex","console","error","message","decodeCursor","value","parse","decodeURIComponent","decoded"],"sources":["cursors.ts"],"sourcesContent":["import { PrimitiveValue } from \"~/types\";\n\n/**\n * Encode a received cursor value into something that can be passed on to the user.\n */\nexport const encodeCursor = (cursor?: string | string[] | null): string | undefined => {\n if (!cursor) {\n return undefined;\n }\n\n cursor = Array.isArray(cursor) ? cursor.map(encodeURIComponent) : encodeURIComponent(cursor);\n\n try {\n return Buffer.from(JSON.stringify(cursor)).toString(\"base64\");\n } catch (ex) {\n console.error(ex.message);\n }\n return undefined;\n};\n/**\n * Decode a received value into a Elasticsearch cursor.\n * If no value is received or is not decodable, return undefined.\n */\nexport const decodeCursor = (cursor?: string | null): PrimitiveValue[] | undefined => {\n if (!cursor) {\n return undefined;\n }\n try {\n const value = JSON.parse(Buffer.from(cursor, \"base64\").toString(\"ascii\"));\n if (Array.isArray(value)) {\n return value.map(decodeURIComponent);\n }\n const decoded = decodeURIComponent(value);\n return decoded ? [decoded] : undefined;\n } catch (ex) {\n console.error(ex.message);\n }\n return undefined;\n};\n"],"mappings":";;;;;;;AAEA;AACA;AACA;AACO,MAAMA,YAAY,GAAIC,MAAD,IAA2D;EACnF,IAAI,CAACA,MAAL,EAAa;IACT,OAAOC,SAAP;EACH;;EAEDD,MAAM,GAAGE,KAAK,CAACC,OAAN,CAAcH,MAAd,IAAwBA,MAAM,CAACI,GAAP,CAAWC,kBAAX,CAAxB,GAAyDA,kBAAkB,CAACL,MAAD,CAApF;;EAEA,IAAI;IACA,OAAOM,MAAM,CAACC,IAAP,CAAYC,IAAI,CAACC,SAAL,CAAeT,MAAf,CAAZ,EAAoCU,QAApC,CAA6C,QAA7C,CAAP;EACH,CAFD,CAEE,OAAOC,EAAP,EAAW;IACTC,OAAO,CAACC,KAAR,CAAcF,EAAE,CAACG,OAAjB;EACH;;EACD,OAAOb,SAAP;AACH,CAbM;AAcP;AACA;AACA;AACA;;;;;AACO,MAAMc,YAAY,GAAIf,MAAD,IAA0D;EAClF,IAAI,CAACA,MAAL,EAAa;IACT,OAAOC,SAAP;EACH;;EACD,IAAI;IACA,MAAMe,KAAK,GAAGR,IAAI,CAACS,KAAL,CAAWX,MAAM,CAACC,IAAP,CAAYP,MAAZ,EAAoB,QAApB,EAA8BU,QAA9B,CAAuC,OAAvC,CAAX,CAAd;;IACA,IAAIR,KAAK,CAACC,OAAN,CAAca,KAAd,CAAJ,EAA0B;MACtB,OAAOA,KAAK,CAACZ,GAAN,CAAUc,kBAAV,CAAP;IACH;;IACD,MAAMC,OAAO,GAAGD,kBAAkB,CAACF,KAAD,CAAlC;IACA,OAAOG,OAAO,GAAG,CAACA,OAAD,CAAH,GAAelB,SAA7B;EACH,CAPD,CAOE,OAAOU,EAAP,EAAW;IACTC,OAAO,CAACC,KAAR,CAAcF,EAAE,CAACG,OAAjB;EACH;;EACD,OAAOb,SAAP;AACH,CAfM"}
|
package/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
@@ -14,9 +15,13 @@ Object.defineProperty(exports, "createGzipCompression", {
|
|
|
14
15
|
}
|
|
15
16
|
});
|
|
16
17
|
exports.default = void 0;
|
|
18
|
+
|
|
17
19
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
20
|
+
|
|
18
21
|
var _api = require("@webiny/api");
|
|
22
|
+
|
|
19
23
|
var _client = require("./client");
|
|
24
|
+
|
|
20
25
|
Object.keys(_client).forEach(function (key) {
|
|
21
26
|
if (key === "default" || key === "__esModule") return;
|
|
22
27
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -28,7 +33,9 @@ Object.keys(_client).forEach(function (key) {
|
|
|
28
33
|
}
|
|
29
34
|
});
|
|
30
35
|
});
|
|
36
|
+
|
|
31
37
|
var _operators = require("./operators");
|
|
38
|
+
|
|
32
39
|
Object.keys(_operators).forEach(function (key) {
|
|
33
40
|
if (key === "default" || key === "__esModule") return;
|
|
34
41
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -40,8 +47,11 @@ Object.keys(_operators).forEach(function (key) {
|
|
|
40
47
|
}
|
|
41
48
|
});
|
|
42
49
|
});
|
|
50
|
+
|
|
43
51
|
var _elasticsearch = require("@elastic/elasticsearch");
|
|
52
|
+
|
|
44
53
|
var _indexConfiguration = require("./indexConfiguration");
|
|
54
|
+
|
|
45
55
|
Object.keys(_indexConfiguration).forEach(function (key) {
|
|
46
56
|
if (key === "default" || key === "__esModule") return;
|
|
47
57
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -53,7 +63,9 @@ Object.keys(_indexConfiguration).forEach(function (key) {
|
|
|
53
63
|
}
|
|
54
64
|
});
|
|
55
65
|
});
|
|
66
|
+
|
|
56
67
|
var _plugins = require("./plugins");
|
|
68
|
+
|
|
57
69
|
Object.keys(_plugins).forEach(function (key) {
|
|
58
70
|
if (key === "default" || key === "__esModule") return;
|
|
59
71
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -65,7 +77,9 @@ Object.keys(_plugins).forEach(function (key) {
|
|
|
65
77
|
}
|
|
66
78
|
});
|
|
67
79
|
});
|
|
80
|
+
|
|
68
81
|
var _sort = require("./sort");
|
|
82
|
+
|
|
69
83
|
Object.keys(_sort).forEach(function (key) {
|
|
70
84
|
if (key === "default" || key === "__esModule") return;
|
|
71
85
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -77,7 +91,9 @@ Object.keys(_sort).forEach(function (key) {
|
|
|
77
91
|
}
|
|
78
92
|
});
|
|
79
93
|
});
|
|
94
|
+
|
|
80
95
|
var _indices = require("./indices");
|
|
96
|
+
|
|
81
97
|
Object.keys(_indices).forEach(function (key) {
|
|
82
98
|
if (key === "default" || key === "__esModule") return;
|
|
83
99
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -89,7 +105,9 @@ Object.keys(_indices).forEach(function (key) {
|
|
|
89
105
|
}
|
|
90
106
|
});
|
|
91
107
|
});
|
|
108
|
+
|
|
92
109
|
var _where = require("./where");
|
|
110
|
+
|
|
93
111
|
Object.keys(_where).forEach(function (key) {
|
|
94
112
|
if (key === "default" || key === "__esModule") return;
|
|
95
113
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -101,7 +119,9 @@ Object.keys(_where).forEach(function (key) {
|
|
|
101
119
|
}
|
|
102
120
|
});
|
|
103
121
|
});
|
|
122
|
+
|
|
104
123
|
var _limit = require("./limit");
|
|
124
|
+
|
|
105
125
|
Object.keys(_limit).forEach(function (key) {
|
|
106
126
|
if (key === "default" || key === "__esModule") return;
|
|
107
127
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -113,7 +133,9 @@ Object.keys(_limit).forEach(function (key) {
|
|
|
113
133
|
}
|
|
114
134
|
});
|
|
115
135
|
});
|
|
136
|
+
|
|
116
137
|
var _normalize = require("./normalize");
|
|
138
|
+
|
|
117
139
|
Object.keys(_normalize).forEach(function (key) {
|
|
118
140
|
if (key === "default" || key === "__esModule") return;
|
|
119
141
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -125,7 +147,9 @@ Object.keys(_normalize).forEach(function (key) {
|
|
|
125
147
|
}
|
|
126
148
|
});
|
|
127
149
|
});
|
|
150
|
+
|
|
128
151
|
var _compression = require("./compression");
|
|
152
|
+
|
|
129
153
|
Object.keys(_compression).forEach(function (key) {
|
|
130
154
|
if (key === "default" || key === "__esModule") return;
|
|
131
155
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -137,7 +161,9 @@ Object.keys(_compression).forEach(function (key) {
|
|
|
137
161
|
}
|
|
138
162
|
});
|
|
139
163
|
});
|
|
164
|
+
|
|
140
165
|
var _cursors = require("./cursors");
|
|
166
|
+
|
|
141
167
|
Object.keys(_cursors).forEach(function (key) {
|
|
142
168
|
if (key === "default" || key === "__esModule") return;
|
|
143
169
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -149,10 +175,13 @@ Object.keys(_cursors).forEach(function (key) {
|
|
|
149
175
|
}
|
|
150
176
|
});
|
|
151
177
|
});
|
|
178
|
+
|
|
152
179
|
var _GzipCompression = require("./plugins/GzipCompression");
|
|
180
|
+
|
|
153
181
|
/**
|
|
154
182
|
* TODO File should contain only exports from other files.
|
|
155
183
|
*/
|
|
184
|
+
|
|
156
185
|
/**
|
|
157
186
|
* We must accept either Elasticsearch client or options that create the client.
|
|
158
187
|
*/
|
|
@@ -164,8 +193,11 @@ var _default = params => {
|
|
|
164
193
|
/**
|
|
165
194
|
* Initialize the Elasticsearch client.
|
|
166
195
|
*/
|
|
196
|
+
|
|
197
|
+
|
|
167
198
|
context.elasticsearch = params instanceof _elasticsearch.Client ? params : (0, _client.createElasticsearchClient)(params);
|
|
168
199
|
context.plugins.register((0, _operators.getElasticsearchOperators)());
|
|
169
200
|
});
|
|
170
201
|
};
|
|
202
|
+
|
|
171
203
|
exports.default = _default;
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["params","ContextPlugin","context","elasticsearch","WebinyError","Client","createElasticsearchClient","plugins","register","getElasticsearchOperators"],"sources":["index.ts"],"sourcesContent":["/**\n * TODO File should contain only exports from other files.\n */\nimport WebinyError from \"@webiny/error\";\nimport { ElasticsearchContext } from \"~/types\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { createElasticsearchClient, ElasticsearchClientOptions } from \"~/client\";\nimport { getElasticsearchOperators } from \"~/operators\";\nimport { Client } from \"@elastic/elasticsearch\";\n\nexport * from \"./indexConfiguration\";\nexport * from \"./plugins\";\nexport * from \"./sort\";\nexport * from \"./indices\";\nexport * from \"./where\";\nexport * from \"./limit\";\nexport * from \"./normalize\";\nexport * from \"./compression\";\nexport * from \"./operators\";\nexport * from \"./cursors\";\nexport * from \"./client\";\nexport { createGzipCompression } from \"./plugins/GzipCompression\";\n\n/**\n * We must accept either Elasticsearch client or options that create the client.\n */\nexport default (\n params: ElasticsearchClientOptions | Client\n): ContextPlugin<ElasticsearchContext> => {\n return new ContextPlugin<ElasticsearchContext>(context => {\n if (context.elasticsearch) {\n throw new WebinyError(\n \"Elasticsearch client is already initialized, no need to define it again. Check your code for duplicate initializations.\",\n \"ELASTICSEARCH_ALREADY_INITIALIZED\"\n );\n }\n /**\n * Initialize the Elasticsearch client.\n */\n context.elasticsearch =\n params instanceof Client ? params : createElasticsearchClient(params);\n\n context.plugins.register(getElasticsearchOperators());\n });\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["params","ContextPlugin","context","elasticsearch","WebinyError","Client","createElasticsearchClient","plugins","register","getElasticsearchOperators"],"sources":["index.ts"],"sourcesContent":["/**\n * TODO File should contain only exports from other files.\n */\nimport WebinyError from \"@webiny/error\";\nimport { ElasticsearchContext } from \"~/types\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { createElasticsearchClient, ElasticsearchClientOptions } from \"~/client\";\nimport { getElasticsearchOperators } from \"~/operators\";\nimport { Client } from \"@elastic/elasticsearch\";\n\nexport * from \"./indexConfiguration\";\nexport * from \"./plugins\";\nexport * from \"./sort\";\nexport * from \"./indices\";\nexport * from \"./where\";\nexport * from \"./limit\";\nexport * from \"./normalize\";\nexport * from \"./compression\";\nexport * from \"./operators\";\nexport * from \"./cursors\";\nexport * from \"./client\";\nexport { createGzipCompression } from \"./plugins/GzipCompression\";\n\n/**\n * We must accept either Elasticsearch client or options that create the client.\n */\nexport default (\n params: ElasticsearchClientOptions | Client\n): ContextPlugin<ElasticsearchContext> => {\n return new ContextPlugin<ElasticsearchContext>(context => {\n if (context.elasticsearch) {\n throw new WebinyError(\n \"Elasticsearch client is already initialized, no need to define it again. Check your code for duplicate initializations.\",\n \"ELASTICSEARCH_ALREADY_INITIALIZED\"\n );\n }\n /**\n * Initialize the Elasticsearch client.\n */\n context.elasticsearch =\n params instanceof Client ? params : createElasticsearchClient(params);\n\n context.plugins.register(getElasticsearchOperators());\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAGA;;AAEA;;AACA;;AAcA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAbA;;AAWA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAVA;;AAEA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAEA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAEA;;AArBA;AACA;AACA;;AAqBA;AACA;AACA;eAEIA,MADW,IAE2B;EACtC,OAAO,IAAIC,kBAAJ,CAAwCC,OAAO,IAAI;IACtD,IAAIA,OAAO,CAACC,aAAZ,EAA2B;MACvB,MAAM,IAAIC,cAAJ,CACF,yHADE,EAEF,mCAFE,CAAN;IAIH;IACD;AACR;AACA;;;IACQF,OAAO,CAACC,aAAR,GACIH,MAAM,YAAYK,qBAAlB,GAA2BL,MAA3B,GAAoC,IAAAM,iCAAA,EAA0BN,MAA1B,CADxC;IAGAE,OAAO,CAACK,OAAR,CAAgBC,QAAhB,CAAyB,IAAAC,oCAAA,GAAzB;EACH,CAdM,CAAP;AAeH,C"}
|
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getBaseConfiguration = void 0;
|
|
7
|
+
|
|
7
8
|
var _common = require("./common");
|
|
9
|
+
|
|
8
10
|
const config = {
|
|
9
11
|
mappings: {
|
|
10
12
|
dynamic_templates: (0, _common.getCommonMappings)(mappings => {
|
|
@@ -31,10 +33,13 @@ const config = {
|
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
};
|
|
36
|
+
|
|
34
37
|
const getBaseConfiguration = modifier => {
|
|
35
38
|
if (!modifier) {
|
|
36
39
|
return config;
|
|
37
40
|
}
|
|
41
|
+
|
|
38
42
|
return modifier(config);
|
|
39
43
|
};
|
|
44
|
+
|
|
40
45
|
exports.getBaseConfiguration = getBaseConfiguration;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["config","mappings","dynamic_templates","getCommonMappings","concat","strings","match_mapping_type","mapping","type","fields","keyword","ignore_above","properties","rawValues","enabled","getBaseConfiguration","modifier"],"sources":["base.ts"],"sourcesContent":["import { ElasticsearchIndexRequestBody } from \"~/types\";\nimport { getCommonMappings } from \"./common\";\n\nconst config: ElasticsearchIndexRequestBody = {\n mappings: {\n dynamic_templates: getCommonMappings(mappings => {\n return mappings.concat([\n {\n strings: {\n match_mapping_type: \"string\",\n mapping: {\n type: \"text\",\n fields: {\n keyword: {\n type: \"keyword\",\n ignore_above: 256\n }\n }\n }\n }\n }\n ]);\n }),\n properties: {\n rawValues: {\n type: \"object\",\n enabled: false\n }\n }\n }\n};\n\ninterface Modifier {\n (config: ElasticsearchIndexRequestBody): ElasticsearchIndexRequestBody;\n}\nexport const getBaseConfiguration = (modifier?: Modifier) => {\n if (!modifier) {\n return config;\n }\n return modifier(config);\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["config","mappings","dynamic_templates","getCommonMappings","concat","strings","match_mapping_type","mapping","type","fields","keyword","ignore_above","properties","rawValues","enabled","getBaseConfiguration","modifier"],"sources":["base.ts"],"sourcesContent":["import { ElasticsearchIndexRequestBody } from \"~/types\";\nimport { getCommonMappings } from \"./common\";\n\nconst config: ElasticsearchIndexRequestBody = {\n mappings: {\n dynamic_templates: getCommonMappings(mappings => {\n return mappings.concat([\n {\n strings: {\n match_mapping_type: \"string\",\n mapping: {\n type: \"text\",\n fields: {\n keyword: {\n type: \"keyword\",\n ignore_above: 256\n }\n }\n }\n }\n }\n ]);\n }),\n properties: {\n rawValues: {\n type: \"object\",\n enabled: false\n }\n }\n }\n};\n\ninterface Modifier {\n (config: ElasticsearchIndexRequestBody): ElasticsearchIndexRequestBody;\n}\nexport const getBaseConfiguration = (modifier?: Modifier) => {\n if (!modifier) {\n return config;\n }\n return modifier(config);\n};\n"],"mappings":";;;;;;;AACA;;AAEA,MAAMA,MAAqC,GAAG;EAC1CC,QAAQ,EAAE;IACNC,iBAAiB,EAAE,IAAAC,yBAAA,EAAkBF,QAAQ,IAAI;MAC7C,OAAOA,QAAQ,CAACG,MAAT,CAAgB,CACnB;QACIC,OAAO,EAAE;UACLC,kBAAkB,EAAE,QADf;UAELC,OAAO,EAAE;YACLC,IAAI,EAAE,MADD;YAELC,MAAM,EAAE;cACJC,OAAO,EAAE;gBACLF,IAAI,EAAE,SADD;gBAELG,YAAY,EAAE;cAFT;YADL;UAFH;QAFJ;MADb,CADmB,CAAhB,CAAP;IAgBH,CAjBkB,CADb;IAmBNC,UAAU,EAAE;MACRC,SAAS,EAAE;QACPL,IAAI,EAAE,QADC;QAEPM,OAAO,EAAE;MAFF;IADH;EAnBN;AADgC,CAA9C;;AAgCO,MAAMC,oBAAoB,GAAIC,QAAD,IAAyB;EACzD,IAAI,CAACA,QAAL,EAAe;IACX,OAAOhB,MAAP;EACH;;EACD,OAAOgB,QAAQ,CAAChB,MAAD,CAAf;AACH,CALM"}
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getCommonMappings = void 0;
|
|
7
|
+
|
|
7
8
|
const getDefaultMappings = () => {
|
|
8
9
|
return [{
|
|
9
10
|
dates: {
|
|
@@ -29,6 +30,7 @@ const getDefaultMappings = () => {
|
|
|
29
30
|
}
|
|
30
31
|
}];
|
|
31
32
|
};
|
|
33
|
+
|
|
32
34
|
/**
|
|
33
35
|
* @internal
|
|
34
36
|
*/
|
|
@@ -36,6 +38,8 @@ const getCommonMappings = cb => {
|
|
|
36
38
|
if (!cb) {
|
|
37
39
|
return getDefaultMappings();
|
|
38
40
|
}
|
|
41
|
+
|
|
39
42
|
return cb(getDefaultMappings());
|
|
40
43
|
};
|
|
44
|
+
|
|
41
45
|
exports.getCommonMappings = getCommonMappings;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getDefaultMappings","dates","match","mapping","type","numbers","scaling_factor","booleans","getCommonMappings","cb"],"sources":["common.ts"],"sourcesContent":["import { ElasticsearchIndexRequestBodyMappingsDynamicTemplate } from \"~/types\";\n\nconst getDefaultMappings = (): ElasticsearchIndexRequestBodyMappingsDynamicTemplate[] => {\n return [\n {\n dates: {\n match: \"^createdOn|savedOn|publishedOn$\",\n mapping: {\n type: \"date\"\n }\n }\n },\n {\n numbers: {\n match: \"number@*\",\n mapping: {\n type: \"scaled_float\",\n scaling_factor: 10000\n }\n }\n },\n {\n booleans: {\n match: \"boolean@*\",\n mapping: {\n type: \"boolean\"\n }\n }\n }\n ];\n};\n\ninterface Modifier {\n (\n mappings: ElasticsearchIndexRequestBodyMappingsDynamicTemplate[]\n ): ElasticsearchIndexRequestBodyMappingsDynamicTemplate[];\n}\n/**\n * @internal\n */\nexport const getCommonMappings = (\n cb?: Modifier\n): ElasticsearchIndexRequestBodyMappingsDynamicTemplate[] => {\n if (!cb) {\n return getDefaultMappings();\n }\n\n return cb(getDefaultMappings());\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["getDefaultMappings","dates","match","mapping","type","numbers","scaling_factor","booleans","getCommonMappings","cb"],"sources":["common.ts"],"sourcesContent":["import { ElasticsearchIndexRequestBodyMappingsDynamicTemplate } from \"~/types\";\n\nconst getDefaultMappings = (): ElasticsearchIndexRequestBodyMappingsDynamicTemplate[] => {\n return [\n {\n dates: {\n match: \"^createdOn|savedOn|publishedOn$\",\n mapping: {\n type: \"date\"\n }\n }\n },\n {\n numbers: {\n match: \"number@*\",\n mapping: {\n type: \"scaled_float\",\n scaling_factor: 10000\n }\n }\n },\n {\n booleans: {\n match: \"boolean@*\",\n mapping: {\n type: \"boolean\"\n }\n }\n }\n ];\n};\n\ninterface Modifier {\n (\n mappings: ElasticsearchIndexRequestBodyMappingsDynamicTemplate[]\n ): ElasticsearchIndexRequestBodyMappingsDynamicTemplate[];\n}\n/**\n * @internal\n */\nexport const getCommonMappings = (\n cb?: Modifier\n): ElasticsearchIndexRequestBodyMappingsDynamicTemplate[] => {\n if (!cb) {\n return getDefaultMappings();\n }\n\n return cb(getDefaultMappings());\n};\n"],"mappings":";;;;;;;AAEA,MAAMA,kBAAkB,GAAG,MAA8D;EACrF,OAAO,CACH;IACIC,KAAK,EAAE;MACHC,KAAK,EAAE,iCADJ;MAEHC,OAAO,EAAE;QACLC,IAAI,EAAE;MADD;IAFN;EADX,CADG,EASH;IACIC,OAAO,EAAE;MACLH,KAAK,EAAE,UADF;MAELC,OAAO,EAAE;QACLC,IAAI,EAAE,cADD;QAELE,cAAc,EAAE;MAFX;IAFJ;EADb,CATG,EAkBH;IACIC,QAAQ,EAAE;MACNL,KAAK,EAAE,WADD;MAENC,OAAO,EAAE;QACLC,IAAI,EAAE;MADD;IAFH;EADd,CAlBG,CAAP;AA2BH,CA5BD;;AAmCA;AACA;AACA;AACO,MAAMI,iBAAiB,GAC1BC,EAD6B,IAE4B;EACzD,IAAI,CAACA,EAAL,EAAS;IACL,OAAOT,kBAAkB,EAAzB;EACH;;EAED,OAAOS,EAAE,CAACT,kBAAkB,EAAnB,CAAT;AACH,CARM"}
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
|
|
6
7
|
var _base = require("./base");
|
|
8
|
+
|
|
7
9
|
Object.keys(_base).forEach(function (key) {
|
|
8
10
|
if (key === "default" || key === "__esModule") return;
|
|
9
11
|
if (key in exports && exports[key] === _base[key]) return;
|
|
@@ -14,7 +16,9 @@ Object.keys(_base).forEach(function (key) {
|
|
|
14
16
|
}
|
|
15
17
|
});
|
|
16
18
|
});
|
|
19
|
+
|
|
17
20
|
var _common = require("./common");
|
|
21
|
+
|
|
18
22
|
Object.keys(_common).forEach(function (key) {
|
|
19
23
|
if (key === "default" || key === "__esModule") return;
|
|
20
24
|
if (key in exports && exports[key] === _common[key]) return;
|
|
@@ -25,7 +29,9 @@ Object.keys(_common).forEach(function (key) {
|
|
|
25
29
|
}
|
|
26
30
|
});
|
|
27
31
|
});
|
|
32
|
+
|
|
28
33
|
var _japanese = require("./japanese");
|
|
34
|
+
|
|
29
35
|
Object.keys(_japanese).forEach(function (key) {
|
|
30
36
|
if (key === "default" || key === "__esModule") return;
|
|
31
37
|
if (key in exports && exports[key] === _japanese[key]) return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./base\";\nexport * from \"./common\";\nexport * from \"./japanese\";\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./base\";\nexport * from \"./common\";\nexport * from \"./japanese\";\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"}
|
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getJapaneseConfiguration = void 0;
|
|
7
|
+
|
|
7
8
|
var _common = require("./common");
|
|
9
|
+
|
|
8
10
|
const config = {
|
|
9
11
|
settings: {
|
|
10
12
|
index: {
|
|
@@ -110,10 +112,13 @@ const config = {
|
|
|
110
112
|
}
|
|
111
113
|
}
|
|
112
114
|
};
|
|
115
|
+
|
|
113
116
|
const getJapaneseConfiguration = modifier => {
|
|
114
117
|
if (!modifier) {
|
|
115
118
|
return config;
|
|
116
119
|
}
|
|
120
|
+
|
|
117
121
|
return modifier(config);
|
|
118
122
|
};
|
|
123
|
+
|
|
119
124
|
exports.getJapaneseConfiguration = getJapaneseConfiguration;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["config","settings","index","analysis","char_filter","normalize","type","name","mode","tokenizer","ja_kuromoji_tokenizer","discard_compound_token","user_dictionary_rules","ja_ngram_tokenizer","min_gram","max_gram","token_chars","filter","ja_index_synonym","lenient","synonyms","ja_search_synonym","analyzer","ja_kuromoji_index_analyzer","ja_kuromoji_search_analyzer","ja_ngram_index_analyzer","ja_ngram_search_analyzer","default","default_search","mappings","numeric_detection","dynamic_templates","getCommonMappings","concat","strings","match_mapping_type","mapping","search_analyzer","fields","ngram","keyword","ignore_above","properties","rawValues","enabled","getJapaneseConfiguration","modifier"],"sources":["japanese.ts"],"sourcesContent":["import { ElasticsearchIndexRequestBody } from \"~/types\";\nimport { getCommonMappings } from \"./common\";\n\nconst config: ElasticsearchIndexRequestBody = {\n settings: {\n index: {\n analysis: {\n char_filter: {\n normalize: {\n type: \"icu_normalizer\",\n name: \"nfkc\",\n mode: \"compose\"\n }\n },\n tokenizer: {\n ja_kuromoji_tokenizer: {\n mode: \"search\",\n type: \"kuromoji_tokenizer\",\n discard_compound_token: \"true\",\n user_dictionary_rules: [\n \"東京スカイツリー,東京 スカイツリー,トウキョウ スカイツリー,カスタム名詞\"\n ]\n },\n ja_ngram_tokenizer: {\n type: \"ngram\",\n min_gram: \"2\",\n max_gram: \"2\",\n token_chars: [\"letter\", \"digit\"]\n }\n },\n filter: {\n ja_index_synonym: {\n type: \"synonym\",\n lenient: \"false\",\n synonyms: []\n },\n ja_search_synonym: {\n type: \"synonym_graph\",\n lenient: \"false\",\n synonyms: [\"米国, アメリカ\", \"東京大学, 東大\"]\n }\n },\n analyzer: {\n ja_kuromoji_index_analyzer: {\n type: \"custom\",\n char_filter: [\"normalize\"],\n tokenizer: \"ja_kuromoji_tokenizer\",\n filter: [\n \"kuromoji_baseform\",\n \"kuromoji_part_of_speech\",\n \"ja_index_synonym\",\n \"cjk_width\",\n \"ja_stop\",\n \"kuromoji_stemmer\",\n \"lowercase\"\n ]\n },\n ja_kuromoji_search_analyzer: {\n type: \"custom\",\n char_filter: [\"normalize\"],\n tokenizer: \"ja_kuromoji_tokenizer\",\n filter: [\n \"kuromoji_baseform\",\n \"kuromoji_part_of_speech\",\n \"ja_search_synonym\",\n \"cjk_width\",\n \"ja_stop\",\n \"kuromoji_stemmer\",\n \"lowercase\"\n ]\n },\n ja_ngram_index_analyzer: {\n type: \"custom\",\n char_filter: [\"normalize\"],\n tokenizer: \"ja_ngram_tokenizer\",\n filter: [\"lowercase\"]\n },\n ja_ngram_search_analyzer: {\n type: \"custom\",\n char_filter: [\"normalize\"],\n tokenizer: \"ja_ngram_tokenizer\",\n filter: [\"ja_search_synonym\", \"lowercase\"]\n }\n },\n default: {\n type: \"ja_kuromoji_index_analyzer\"\n },\n default_search: {\n type: \"ja_kuromoji_search_analyzer\"\n }\n }\n }\n },\n mappings: {\n numeric_detection: true,\n dynamic_templates: getCommonMappings(mappings => {\n return mappings.concat([\n {\n strings: {\n match_mapping_type: \"string\",\n mapping: {\n type: \"text\",\n search_analyzer: \"ja_kuromoji_search_analyzer\",\n analyzer: \"ja_kuromoji_index_analyzer\",\n fields: {\n ngram: {\n type: \"text\",\n search_analyzer: \"ja_ngram_search_analyzer\",\n analyzer: \"ja_ngram_index_analyzer\"\n },\n keyword: {\n ignore_above: 256,\n type: \"keyword\"\n }\n }\n }\n }\n }\n ]);\n }),\n properties: {\n rawValues: {\n type: \"object\",\n enabled: false\n }\n }\n }\n};\n\ninterface Modifier {\n (config: ElasticsearchIndexRequestBody): ElasticsearchIndexRequestBody;\n}\nexport const getJapaneseConfiguration = (modifier?: Modifier) => {\n if (!modifier) {\n return config;\n }\n return modifier(config);\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["config","settings","index","analysis","char_filter","normalize","type","name","mode","tokenizer","ja_kuromoji_tokenizer","discard_compound_token","user_dictionary_rules","ja_ngram_tokenizer","min_gram","max_gram","token_chars","filter","ja_index_synonym","lenient","synonyms","ja_search_synonym","analyzer","ja_kuromoji_index_analyzer","ja_kuromoji_search_analyzer","ja_ngram_index_analyzer","ja_ngram_search_analyzer","default","default_search","mappings","numeric_detection","dynamic_templates","getCommonMappings","concat","strings","match_mapping_type","mapping","search_analyzer","fields","ngram","keyword","ignore_above","properties","rawValues","enabled","getJapaneseConfiguration","modifier"],"sources":["japanese.ts"],"sourcesContent":["import { ElasticsearchIndexRequestBody } from \"~/types\";\nimport { getCommonMappings } from \"./common\";\n\nconst config: ElasticsearchIndexRequestBody = {\n settings: {\n index: {\n analysis: {\n char_filter: {\n normalize: {\n type: \"icu_normalizer\",\n name: \"nfkc\",\n mode: \"compose\"\n }\n },\n tokenizer: {\n ja_kuromoji_tokenizer: {\n mode: \"search\",\n type: \"kuromoji_tokenizer\",\n discard_compound_token: \"true\",\n user_dictionary_rules: [\n \"東京スカイツリー,東京 スカイツリー,トウキョウ スカイツリー,カスタム名詞\"\n ]\n },\n ja_ngram_tokenizer: {\n type: \"ngram\",\n min_gram: \"2\",\n max_gram: \"2\",\n token_chars: [\"letter\", \"digit\"]\n }\n },\n filter: {\n ja_index_synonym: {\n type: \"synonym\",\n lenient: \"false\",\n synonyms: []\n },\n ja_search_synonym: {\n type: \"synonym_graph\",\n lenient: \"false\",\n synonyms: [\"米国, アメリカ\", \"東京大学, 東大\"]\n }\n },\n analyzer: {\n ja_kuromoji_index_analyzer: {\n type: \"custom\",\n char_filter: [\"normalize\"],\n tokenizer: \"ja_kuromoji_tokenizer\",\n filter: [\n \"kuromoji_baseform\",\n \"kuromoji_part_of_speech\",\n \"ja_index_synonym\",\n \"cjk_width\",\n \"ja_stop\",\n \"kuromoji_stemmer\",\n \"lowercase\"\n ]\n },\n ja_kuromoji_search_analyzer: {\n type: \"custom\",\n char_filter: [\"normalize\"],\n tokenizer: \"ja_kuromoji_tokenizer\",\n filter: [\n \"kuromoji_baseform\",\n \"kuromoji_part_of_speech\",\n \"ja_search_synonym\",\n \"cjk_width\",\n \"ja_stop\",\n \"kuromoji_stemmer\",\n \"lowercase\"\n ]\n },\n ja_ngram_index_analyzer: {\n type: \"custom\",\n char_filter: [\"normalize\"],\n tokenizer: \"ja_ngram_tokenizer\",\n filter: [\"lowercase\"]\n },\n ja_ngram_search_analyzer: {\n type: \"custom\",\n char_filter: [\"normalize\"],\n tokenizer: \"ja_ngram_tokenizer\",\n filter: [\"ja_search_synonym\", \"lowercase\"]\n }\n },\n default: {\n type: \"ja_kuromoji_index_analyzer\"\n },\n default_search: {\n type: \"ja_kuromoji_search_analyzer\"\n }\n }\n }\n },\n mappings: {\n numeric_detection: true,\n dynamic_templates: getCommonMappings(mappings => {\n return mappings.concat([\n {\n strings: {\n match_mapping_type: \"string\",\n mapping: {\n type: \"text\",\n search_analyzer: \"ja_kuromoji_search_analyzer\",\n analyzer: \"ja_kuromoji_index_analyzer\",\n fields: {\n ngram: {\n type: \"text\",\n search_analyzer: \"ja_ngram_search_analyzer\",\n analyzer: \"ja_ngram_index_analyzer\"\n },\n keyword: {\n ignore_above: 256,\n type: \"keyword\"\n }\n }\n }\n }\n }\n ]);\n }),\n properties: {\n rawValues: {\n type: \"object\",\n enabled: false\n }\n }\n }\n};\n\ninterface Modifier {\n (config: ElasticsearchIndexRequestBody): ElasticsearchIndexRequestBody;\n}\nexport const getJapaneseConfiguration = (modifier?: Modifier) => {\n if (!modifier) {\n return config;\n }\n return modifier(config);\n};\n"],"mappings":"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"}
|
package/indices.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.getLastAddedIndexPlugin = void 0;
|
|
9
|
+
|
|
8
10
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
11
|
+
|
|
9
12
|
const listIndicesPlugins = ({
|
|
10
13
|
container,
|
|
11
14
|
type,
|
|
@@ -15,14 +18,18 @@ const listIndicesPlugins = ({
|
|
|
15
18
|
return plugin.canUse(locale);
|
|
16
19
|
});
|
|
17
20
|
};
|
|
21
|
+
|
|
18
22
|
const getLastAddedIndexPlugin = params => {
|
|
19
23
|
const plugins = listIndicesPlugins(params);
|
|
24
|
+
|
|
20
25
|
if (plugins.length === 0) {
|
|
21
26
|
throw new _error.default(`Could not find a single ElasticsearchIndexPlugin of type "${params.type}".`, "ELASTICSEARCH_INDEX_TEMPLATE_ERROR", {
|
|
22
27
|
type: params.type,
|
|
23
28
|
locale: params.locale
|
|
24
29
|
});
|
|
25
30
|
}
|
|
31
|
+
|
|
26
32
|
return plugins.pop();
|
|
27
33
|
};
|
|
34
|
+
|
|
28
35
|
exports.getLastAddedIndexPlugin = getLastAddedIndexPlugin;
|