@webiny/api-elasticsearch 0.0.0-unstable.5e7233243f → 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.
Files changed (79) hide show
  1. package/client.js +5 -11
  2. package/client.js.map +1 -1
  3. package/cursors.d.ts +2 -1
  4. package/cursors.js +7 -1
  5. package/cursors.js.map +1 -1
  6. package/index.d.ts +12 -0
  7. package/index.js +166 -1
  8. package/index.js.map +1 -1
  9. package/indexConfiguration/base.d.ts +5 -1
  10. package/indexConfiguration/base.js +25 -14
  11. package/indexConfiguration/base.js.map +1 -1
  12. package/indexConfiguration/common.d.ts +5 -1
  13. package/indexConfiguration/common.js +35 -9
  14. package/indexConfiguration/common.js.map +1 -1
  15. package/indexConfiguration/index.d.ts +3 -0
  16. package/indexConfiguration/index.js +44 -0
  17. package/indexConfiguration/index.js.map +1 -0
  18. package/indexConfiguration/japanese.d.ts +5 -1
  19. package/indexConfiguration/japanese.js +33 -21
  20. package/indexConfiguration/japanese.js.map +1 -1
  21. package/indices.js +1 -1
  22. package/normalize.js +3 -6
  23. package/normalize.js.map +1 -1
  24. package/operators.js.map +1 -1
  25. package/package.json +12 -12
  26. package/plugins/GzipCompression.d.ts +5 -0
  27. package/plugins/GzipCompression.js +13 -2
  28. package/plugins/GzipCompression.js.map +1 -1
  29. package/plugins/definition/CompressionPlugin.js +1 -1
  30. package/plugins/definition/ElasticsearchBodyModifierPlugin.js +1 -1
  31. package/plugins/definition/ElasticsearchFieldPlugin.js +4 -6
  32. package/plugins/definition/ElasticsearchFieldPlugin.js.map +1 -1
  33. package/plugins/definition/ElasticsearchIndexPlugin.js +4 -6
  34. package/plugins/definition/ElasticsearchIndexPlugin.js.map +1 -1
  35. package/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.js +1 -1
  36. package/plugins/definition/ElasticsearchQueryModifierPlugin.js +1 -1
  37. package/plugins/definition/ElasticsearchSortModifierPlugin.js +1 -1
  38. package/plugins/definition/index.d.ts +7 -0
  39. package/plugins/definition/index.js +96 -0
  40. package/plugins/definition/index.js.map +1 -0
  41. package/plugins/index.d.ts +2 -0
  42. package/plugins/index.js +31 -0
  43. package/plugins/index.js.map +1 -0
  44. package/plugins/operator/andIn.js +2 -2
  45. package/plugins/operator/andIn.js.map +1 -1
  46. package/plugins/operator/between.js +6 -5
  47. package/plugins/operator/between.js.map +1 -1
  48. package/plugins/operator/contains.js +1 -1
  49. package/plugins/operator/equal.js +24 -5
  50. package/plugins/operator/equal.js.map +1 -1
  51. package/plugins/operator/gt.js +2 -2
  52. package/plugins/operator/gt.js.map +1 -1
  53. package/plugins/operator/gte.js +2 -2
  54. package/plugins/operator/gte.js.map +1 -1
  55. package/plugins/operator/in.js +7 -13
  56. package/plugins/operator/in.js.map +1 -1
  57. package/plugins/operator/japanese/contains.js +1 -1
  58. package/plugins/operator/lt.js +2 -2
  59. package/plugins/operator/lt.js.map +1 -1
  60. package/plugins/operator/lte.js +2 -2
  61. package/plugins/operator/lte.js.map +1 -1
  62. package/plugins/operator/not.js +16 -4
  63. package/plugins/operator/not.js.map +1 -1
  64. package/plugins/operator/notBetween.js +5 -4
  65. package/plugins/operator/notBetween.js.map +1 -1
  66. package/plugins/operator/notContains.js +1 -1
  67. package/plugins/operator/notIn.js +4 -3
  68. package/plugins/operator/notIn.js.map +1 -1
  69. package/plugins/operator/notStartsWith.js +1 -1
  70. package/plugins/operator/startsWith.js +2 -2
  71. package/plugins/operator/startsWith.js.map +1 -1
  72. package/sort.d.ts +2 -6
  73. package/sort.js +1 -3
  74. package/sort.js.map +1 -1
  75. package/types.d.ts +12 -4
  76. package/types.js +2 -2
  77. package/types.js.map +1 -1
  78. package/where.js +2 -1
  79. package/where.js.map +1 -1
package/client.js CHANGED
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.createElasticsearchClient = void 0;
9
9
 
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
11
 
12
12
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
13
13
 
@@ -21,18 +21,13 @@ var _awsElasticsearchConnector = _interopRequireDefault(require("aws-elasticsear
21
21
 
22
22
  const _excluded = ["endpoint", "node"];
23
23
 
24
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
25
-
26
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
27
-
28
24
  const createElasticsearchClient = options => {
29
25
  const {
30
26
  endpoint,
31
27
  node
32
28
  } = options,
33
29
  rest = (0, _objectWithoutProperties2.default)(options, _excluded);
34
-
35
- const clientOptions = _objectSpread({
30
+ const clientOptions = (0, _objectSpread2.default)({
36
31
  node: endpoint || node
37
32
  }, rest);
38
33
 
@@ -46,14 +41,13 @@ const createElasticsearchClient = options => {
46
41
  try {
47
42
  return new _elasticsearch.Client(clientOptions);
48
43
  } catch (ex) {
49
- const data = _objectSpread(_objectSpread({
44
+ const data = (0, _objectSpread2.default)((0, _objectSpread2.default)({
50
45
  error: ex,
51
46
  node: endpoint || node
52
47
  }, rest), {}, {
53
48
  auth: undefined
54
49
  });
55
-
56
- console.log(_objectSpread({}, data));
50
+ console.log((0, _objectSpread2.default)({}, data));
57
51
  throw new _error.default("Could not connect to Elasticsearch.", "ELASTICSEARCH_CLIENT_ERROR", data);
58
52
  }
59
53
  };
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":";;;;;;;;;;;;;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,mBACOJ,IADP;IAGA,MAAM,IAAIK,cAAJ,CACF,qCADE,EAEF,4BAFE,EAGFL,IAHE,CAAN;EAKH;AACJ,CAjCM"}
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/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) => string[] | string | undefined;
10
+ export declare const decodeCursor: (cursor?: string | null) => PrimitiveValue[] | undefined;
package/cursors.js CHANGED
@@ -38,7 +38,13 @@ const decodeCursor = cursor => {
38
38
 
39
39
  try {
40
40
  const value = JSON.parse(Buffer.from(cursor, "base64").toString("ascii"));
41
- return Array.isArray(value) ? value.map(decodeURIComponent) : decodeURIComponent(value);
41
+
42
+ if (Array.isArray(value)) {
43
+ return value.map(decodeURIComponent);
44
+ }
45
+
46
+ const decoded = decodeURIComponent(value);
47
+ return decoded ? [decoded] : undefined;
42
48
  } catch (ex) {
43
49
  console.error(ex.message);
44
50
  }
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): string[] | string | undefined => {\n if (!cursor) {\n return undefined;\n }\n try {\n const value = JSON.parse(Buffer.from(cursor, \"base64\").toString(\"ascii\"));\n\n return Array.isArray(value) ? value.map(decodeURIComponent) : decodeURIComponent(value);\n } catch (ex) {\n console.error(ex.message);\n }\n return undefined;\n};\n"],"mappings":";;;;;;;AAAA;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,IAA2D;EACnF,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;IAEA,OAAOR,KAAK,CAACC,OAAN,CAAca,KAAd,IAAuBA,KAAK,CAACZ,GAAN,CAAUc,kBAAV,CAAvB,GAAuDA,kBAAkB,CAACF,KAAD,CAAhF;EACH,CAJD,CAIE,OAAOL,EAAP,EAAW;IACTC,OAAO,CAACC,KAAR,CAAcF,EAAE,CAACG,OAAjB;EACH;;EACD,OAAOb,SAAP;AACH,CAZM"}
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.d.ts CHANGED
@@ -2,6 +2,18 @@ import { ElasticsearchContext } from "./types";
2
2
  import { ContextPlugin } from "@webiny/api";
3
3
  import { ElasticsearchClientOptions } from "./client";
4
4
  import { Client } from "@elastic/elasticsearch";
5
+ export * from "./indexConfiguration";
6
+ export * from "./plugins";
7
+ export * from "./sort";
8
+ export * from "./indices";
9
+ export * from "./where";
10
+ export * from "./limit";
11
+ export * from "./normalize";
12
+ export * from "./compression";
13
+ export * from "./operators";
14
+ export * from "./cursors";
15
+ export * from "./client";
16
+ export { createGzipCompression } from "./plugins/GzipCompression";
5
17
  /**
6
18
  * We must accept either Elasticsearch client or options that create the client.
7
19
  */
package/index.js CHANGED
@@ -1,10 +1,19 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
+ var _exportNames = {
9
+ createGzipCompression: true
10
+ };
11
+ Object.defineProperty(exports, "createGzipCompression", {
12
+ enumerable: true,
13
+ get: function () {
14
+ return _GzipCompression.createGzipCompression;
15
+ }
16
+ });
8
17
  exports.default = void 0;
9
18
 
10
19
  var _error = _interopRequireDefault(require("@webiny/error"));
@@ -13,10 +22,166 @@ var _api = require("@webiny/api");
13
22
 
14
23
  var _client = require("./client");
15
24
 
25
+ Object.keys(_client).forEach(function (key) {
26
+ if (key === "default" || key === "__esModule") return;
27
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
28
+ if (key in exports && exports[key] === _client[key]) return;
29
+ Object.defineProperty(exports, key, {
30
+ enumerable: true,
31
+ get: function () {
32
+ return _client[key];
33
+ }
34
+ });
35
+ });
36
+
16
37
  var _operators = require("./operators");
17
38
 
39
+ Object.keys(_operators).forEach(function (key) {
40
+ if (key === "default" || key === "__esModule") return;
41
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
42
+ if (key in exports && exports[key] === _operators[key]) return;
43
+ Object.defineProperty(exports, key, {
44
+ enumerable: true,
45
+ get: function () {
46
+ return _operators[key];
47
+ }
48
+ });
49
+ });
50
+
18
51
  var _elasticsearch = require("@elastic/elasticsearch");
19
52
 
53
+ var _indexConfiguration = require("./indexConfiguration");
54
+
55
+ Object.keys(_indexConfiguration).forEach(function (key) {
56
+ if (key === "default" || key === "__esModule") return;
57
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
58
+ if (key in exports && exports[key] === _indexConfiguration[key]) return;
59
+ Object.defineProperty(exports, key, {
60
+ enumerable: true,
61
+ get: function () {
62
+ return _indexConfiguration[key];
63
+ }
64
+ });
65
+ });
66
+
67
+ var _plugins = require("./plugins");
68
+
69
+ Object.keys(_plugins).forEach(function (key) {
70
+ if (key === "default" || key === "__esModule") return;
71
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
72
+ if (key in exports && exports[key] === _plugins[key]) return;
73
+ Object.defineProperty(exports, key, {
74
+ enumerable: true,
75
+ get: function () {
76
+ return _plugins[key];
77
+ }
78
+ });
79
+ });
80
+
81
+ var _sort = require("./sort");
82
+
83
+ Object.keys(_sort).forEach(function (key) {
84
+ if (key === "default" || key === "__esModule") return;
85
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
86
+ if (key in exports && exports[key] === _sort[key]) return;
87
+ Object.defineProperty(exports, key, {
88
+ enumerable: true,
89
+ get: function () {
90
+ return _sort[key];
91
+ }
92
+ });
93
+ });
94
+
95
+ var _indices = require("./indices");
96
+
97
+ Object.keys(_indices).forEach(function (key) {
98
+ if (key === "default" || key === "__esModule") return;
99
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
100
+ if (key in exports && exports[key] === _indices[key]) return;
101
+ Object.defineProperty(exports, key, {
102
+ enumerable: true,
103
+ get: function () {
104
+ return _indices[key];
105
+ }
106
+ });
107
+ });
108
+
109
+ var _where = require("./where");
110
+
111
+ Object.keys(_where).forEach(function (key) {
112
+ if (key === "default" || key === "__esModule") return;
113
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
114
+ if (key in exports && exports[key] === _where[key]) return;
115
+ Object.defineProperty(exports, key, {
116
+ enumerable: true,
117
+ get: function () {
118
+ return _where[key];
119
+ }
120
+ });
121
+ });
122
+
123
+ var _limit = require("./limit");
124
+
125
+ Object.keys(_limit).forEach(function (key) {
126
+ if (key === "default" || key === "__esModule") return;
127
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
128
+ if (key in exports && exports[key] === _limit[key]) return;
129
+ Object.defineProperty(exports, key, {
130
+ enumerable: true,
131
+ get: function () {
132
+ return _limit[key];
133
+ }
134
+ });
135
+ });
136
+
137
+ var _normalize = require("./normalize");
138
+
139
+ Object.keys(_normalize).forEach(function (key) {
140
+ if (key === "default" || key === "__esModule") return;
141
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
142
+ if (key in exports && exports[key] === _normalize[key]) return;
143
+ Object.defineProperty(exports, key, {
144
+ enumerable: true,
145
+ get: function () {
146
+ return _normalize[key];
147
+ }
148
+ });
149
+ });
150
+
151
+ var _compression = require("./compression");
152
+
153
+ Object.keys(_compression).forEach(function (key) {
154
+ if (key === "default" || key === "__esModule") return;
155
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
156
+ if (key in exports && exports[key] === _compression[key]) return;
157
+ Object.defineProperty(exports, key, {
158
+ enumerable: true,
159
+ get: function () {
160
+ return _compression[key];
161
+ }
162
+ });
163
+ });
164
+
165
+ var _cursors = require("./cursors");
166
+
167
+ Object.keys(_cursors).forEach(function (key) {
168
+ if (key === "default" || key === "__esModule") return;
169
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
170
+ if (key in exports && exports[key] === _cursors[key]) return;
171
+ Object.defineProperty(exports, key, {
172
+ enumerable: true,
173
+ get: function () {
174
+ return _cursors[key];
175
+ }
176
+ });
177
+ });
178
+
179
+ var _GzipCompression = require("./plugins/GzipCompression");
180
+
181
+ /**
182
+ * TODO File should contain only exports from other files.
183
+ */
184
+
20
185
  /**
21
186
  * We must accept either Elasticsearch client or options that create the client.
22
187
  */
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":["import 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\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":";;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AAEA;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"}
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"}
@@ -1,2 +1,6 @@
1
1
  import { ElasticsearchIndexRequestBody } from "../types";
2
- export declare const base: ElasticsearchIndexRequestBody;
2
+ interface Modifier {
3
+ (config: ElasticsearchIndexRequestBody): ElasticsearchIndexRequestBody;
4
+ }
5
+ export declare const getBaseConfiguration: (modifier?: Modifier) => ElasticsearchIndexRequestBody;
6
+ export {};
@@ -3,26 +3,28 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.base = void 0;
6
+ exports.getBaseConfiguration = void 0;
7
7
 
8
8
  var _common = require("./common");
9
9
 
10
- const base = {
10
+ const config = {
11
11
  mappings: {
12
- dynamic_templates: _common.dynamicTemplateDates.concat([{
13
- strings: {
14
- match_mapping_type: "string",
15
- mapping: {
16
- type: "text",
17
- fields: {
18
- keyword: {
19
- type: "keyword",
20
- ignore_above: 256
12
+ dynamic_templates: (0, _common.getCommonMappings)(mappings => {
13
+ return mappings.concat([{
14
+ strings: {
15
+ match_mapping_type: "string",
16
+ mapping: {
17
+ type: "text",
18
+ fields: {
19
+ keyword: {
20
+ type: "keyword",
21
+ ignore_above: 256
22
+ }
21
23
  }
22
24
  }
23
25
  }
24
- }
25
- }]),
26
+ }]);
27
+ }),
26
28
  properties: {
27
29
  rawValues: {
28
30
  type: "object",
@@ -31,4 +33,13 @@ const base = {
31
33
  }
32
34
  }
33
35
  };
34
- exports.base = base;
36
+
37
+ const getBaseConfiguration = modifier => {
38
+ if (!modifier) {
39
+ return config;
40
+ }
41
+
42
+ return modifier(config);
43
+ };
44
+
45
+ exports.getBaseConfiguration = getBaseConfiguration;
@@ -1 +1 @@
1
- {"version":3,"names":["base","mappings","dynamic_templates","dynamicTemplateDates","concat","strings","match_mapping_type","mapping","type","fields","keyword","ignore_above","properties","rawValues","enabled"],"sources":["base.ts"],"sourcesContent":["import { ElasticsearchIndexRequestBody } from \"~/types\";\nimport { dynamicTemplateDates } from \"./common\";\n\nexport const base: ElasticsearchIndexRequestBody = {\n mappings: {\n dynamic_templates: dynamicTemplateDates.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 properties: {\n rawValues: {\n type: \"object\",\n enabled: false\n }\n }\n }\n};\n"],"mappings":";;;;;;;AACA;;AAEO,MAAMA,IAAmC,GAAG;EAC/CC,QAAQ,EAAE;IACNC,iBAAiB,EAAEC,4BAAA,CAAqBC,MAArB,CAA4B,CAC3C;MACIC,OAAO,EAAE;QACLC,kBAAkB,EAAE,QADf;QAELC,OAAO,EAAE;UACLC,IAAI,EAAE,MADD;UAELC,MAAM,EAAE;YACJC,OAAO,EAAE;cACLF,IAAI,EAAE,SADD;cAELG,YAAY,EAAE;YAFT;UADL;QAFH;MAFJ;IADb,CAD2C,CAA5B,CADb;IAiBNC,UAAU,EAAE;MACRC,SAAS,EAAE;QACPL,IAAI,EAAE,QADC;QAEPM,OAAO,EAAE;MAFF;IADH;EAjBN;AADqC,CAA5C"}
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"}
@@ -1,5 +1,9 @@
1
1
  import { ElasticsearchIndexRequestBodyMappingsDynamicTemplate } from "../types";
2
+ interface Modifier {
3
+ (mappings: ElasticsearchIndexRequestBodyMappingsDynamicTemplate[]): ElasticsearchIndexRequestBodyMappingsDynamicTemplate[];
4
+ }
2
5
  /**
3
6
  * @internal
4
7
  */
5
- export declare const dynamicTemplateDates: ElasticsearchIndexRequestBodyMappingsDynamicTemplate[];
8
+ export declare const getCommonMappings: (cb?: Modifier) => ElasticsearchIndexRequestBodyMappingsDynamicTemplate[];
9
+ export {};
@@ -3,17 +3,43 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.dynamicTemplateDates = void 0;
6
+ exports.getCommonMappings = void 0;
7
+
8
+ const getDefaultMappings = () => {
9
+ return [{
10
+ dates: {
11
+ match: "^createdOn|savedOn|publishedOn$",
12
+ mapping: {
13
+ type: "date"
14
+ }
15
+ }
16
+ }, {
17
+ numbers: {
18
+ match: "number@*",
19
+ mapping: {
20
+ type: "scaled_float",
21
+ scaling_factor: 10000
22
+ }
23
+ }
24
+ }, {
25
+ booleans: {
26
+ match: "boolean@*",
27
+ mapping: {
28
+ type: "boolean"
29
+ }
30
+ }
31
+ }];
32
+ };
7
33
 
8
34
  /**
9
35
  * @internal
10
36
  */
11
- const dynamicTemplateDates = [{
12
- dates: {
13
- match: "^createdOn|savedOn|publishedOn$",
14
- mapping: {
15
- type: "date"
16
- }
37
+ const getCommonMappings = cb => {
38
+ if (!cb) {
39
+ return getDefaultMappings();
17
40
  }
18
- }];
19
- exports.dynamicTemplateDates = dynamicTemplateDates;
41
+
42
+ return cb(getDefaultMappings());
43
+ };
44
+
45
+ exports.getCommonMappings = getCommonMappings;
@@ -1 +1 @@
1
- {"version":3,"names":["dynamicTemplateDates","dates","match","mapping","type"],"sources":["common.ts"],"sourcesContent":["import { ElasticsearchIndexRequestBodyMappingsDynamicTemplate } from \"~/types\";\n\n/**\n * @internal\n */\nexport const dynamicTemplateDates: ElasticsearchIndexRequestBodyMappingsDynamicTemplate[] = [\n {\n dates: {\n match: \"^createdOn|savedOn|publishedOn$\",\n mapping: {\n type: \"date\"\n }\n }\n }\n];\n"],"mappings":";;;;;;;AAEA;AACA;AACA;AACO,MAAMA,oBAA4E,GAAG,CACxF;EACIC,KAAK,EAAE;IACHC,KAAK,EAAE,iCADJ;IAEHC,OAAO,EAAE;MACLC,IAAI,EAAE;IADD;EAFN;AADX,CADwF,CAArF"}
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"}
@@ -0,0 +1,3 @@
1
+ export * from "./base";
2
+ export * from "./common";
3
+ export * from "./japanese";
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _base = require("./base");
8
+
9
+ Object.keys(_base).forEach(function (key) {
10
+ if (key === "default" || key === "__esModule") return;
11
+ if (key in exports && exports[key] === _base[key]) return;
12
+ Object.defineProperty(exports, key, {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _base[key];
16
+ }
17
+ });
18
+ });
19
+
20
+ var _common = require("./common");
21
+
22
+ Object.keys(_common).forEach(function (key) {
23
+ if (key === "default" || key === "__esModule") return;
24
+ if (key in exports && exports[key] === _common[key]) return;
25
+ Object.defineProperty(exports, key, {
26
+ enumerable: true,
27
+ get: function () {
28
+ return _common[key];
29
+ }
30
+ });
31
+ });
32
+
33
+ var _japanese = require("./japanese");
34
+
35
+ Object.keys(_japanese).forEach(function (key) {
36
+ if (key === "default" || key === "__esModule") return;
37
+ if (key in exports && exports[key] === _japanese[key]) return;
38
+ Object.defineProperty(exports, key, {
39
+ enumerable: true,
40
+ get: function () {
41
+ return _japanese[key];
42
+ }
43
+ });
44
+ });
@@ -0,0 +1 @@
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"}
@@ -1,2 +1,6 @@
1
1
  import { ElasticsearchIndexRequestBody } from "../types";
2
- export declare const japanese: ElasticsearchIndexRequestBody;
2
+ interface Modifier {
3
+ (config: ElasticsearchIndexRequestBody): ElasticsearchIndexRequestBody;
4
+ }
5
+ export declare const getJapaneseConfiguration: (modifier?: Modifier) => ElasticsearchIndexRequestBody;
6
+ export {};
@@ -3,11 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.japanese = void 0;
6
+ exports.getJapaneseConfiguration = void 0;
7
7
 
8
8
  var _common = require("./common");
9
9
 
10
- const japanese = {
10
+ const config = {
11
11
  settings: {
12
12
  index: {
13
13
  analysis: {
@@ -80,27 +80,30 @@ const japanese = {
80
80
  }
81
81
  },
82
82
  mappings: {
83
- dynamic_templates: _common.dynamicTemplateDates.concat([{
84
- strings: {
85
- match_mapping_type: "string",
86
- mapping: {
87
- type: "text",
88
- search_analyzer: "ja_kuromoji_search_analyzer",
89
- analyzer: "ja_kuromoji_index_analyzer",
90
- fields: {
91
- ngram: {
92
- type: "text",
93
- search_analyzer: "ja_ngram_search_analyzer",
94
- analyzer: "ja_ngram_index_analyzer"
95
- },
96
- keyword: {
97
- ignore_above: 256,
98
- type: "keyword"
83
+ numeric_detection: true,
84
+ dynamic_templates: (0, _common.getCommonMappings)(mappings => {
85
+ return mappings.concat([{
86
+ strings: {
87
+ match_mapping_type: "string",
88
+ mapping: {
89
+ type: "text",
90
+ search_analyzer: "ja_kuromoji_search_analyzer",
91
+ analyzer: "ja_kuromoji_index_analyzer",
92
+ fields: {
93
+ ngram: {
94
+ type: "text",
95
+ search_analyzer: "ja_ngram_search_analyzer",
96
+ analyzer: "ja_ngram_index_analyzer"
97
+ },
98
+ keyword: {
99
+ ignore_above: 256,
100
+ type: "keyword"
101
+ }
99
102
  }
100
103
  }
101
104
  }
102
- }
103
- }]),
105
+ }]);
106
+ }),
104
107
  properties: {
105
108
  rawValues: {
106
109
  type: "object",
@@ -109,4 +112,13 @@ const japanese = {
109
112
  }
110
113
  }
111
114
  };
112
- exports.japanese = japanese;
115
+
116
+ const getJapaneseConfiguration = modifier => {
117
+ if (!modifier) {
118
+ return config;
119
+ }
120
+
121
+ return modifier(config);
122
+ };
123
+
124
+ exports.getJapaneseConfiguration = getJapaneseConfiguration;