@webiny/api-elasticsearch 0.0.0-unstable.99666aeb00 → 0.0.0-unstable.a9593f74dd

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 (94) hide show
  1. package/client.d.ts +1 -0
  2. package/client.js +80 -32
  3. package/client.js.map +1 -1
  4. package/compression.js +3 -2
  5. package/compression.js.map +1 -1
  6. package/cursors.js +3 -1
  7. package/cursors.js.map +1 -1
  8. package/index.d.ts +1 -0
  9. package/index.js +15 -1
  10. package/index.js.map +1 -1
  11. package/indexConfiguration/base.js +3 -1
  12. package/indexConfiguration/base.js.map +1 -1
  13. package/indexConfiguration/common.js +3 -1
  14. package/indexConfiguration/common.js.map +1 -1
  15. package/indexConfiguration/index.js +3 -1
  16. package/indexConfiguration/index.js.map +1 -1
  17. package/indexConfiguration/japanese.js +3 -1
  18. package/indexConfiguration/japanese.js.map +1 -1
  19. package/indices.js +3 -1
  20. package/indices.js.map +1 -1
  21. package/limit.js +3 -1
  22. package/limit.js.map +1 -1
  23. package/normalize.d.ts +1 -0
  24. package/normalize.js +39 -3
  25. package/normalize.js.map +1 -1
  26. package/operators.js +3 -1
  27. package/operators.js.map +1 -1
  28. package/package.json +10 -18
  29. package/plugins/GzipCompression.js +3 -1
  30. package/plugins/GzipCompression.js.map +1 -1
  31. package/plugins/definition/CompressionPlugin.js +20 -4
  32. package/plugins/definition/CompressionPlugin.js.map +1 -1
  33. package/plugins/definition/ElasticsearchBodyModifierPlugin.js +3 -3
  34. package/plugins/definition/ElasticsearchBodyModifierPlugin.js.map +1 -1
  35. package/plugins/definition/ElasticsearchFieldPlugin.js +7 -13
  36. package/plugins/definition/ElasticsearchFieldPlugin.js.map +1 -1
  37. package/plugins/definition/ElasticsearchIndexPlugin.js +6 -6
  38. package/plugins/definition/ElasticsearchIndexPlugin.js.map +1 -1
  39. package/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.js +4 -3
  40. package/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.js.map +1 -1
  41. package/plugins/definition/ElasticsearchQueryModifierPlugin.js +3 -3
  42. package/plugins/definition/ElasticsearchQueryModifierPlugin.js.map +1 -1
  43. package/plugins/definition/ElasticsearchSortModifierPlugin.js +3 -3
  44. package/plugins/definition/ElasticsearchSortModifierPlugin.js.map +1 -1
  45. package/plugins/definition/index.js +3 -1
  46. package/plugins/definition/index.js.map +1 -1
  47. package/plugins/index.js +3 -1
  48. package/plugins/index.js.map +1 -1
  49. package/plugins/operator/andIn.js +4 -7
  50. package/plugins/operator/andIn.js.map +1 -1
  51. package/plugins/operator/between.js +4 -7
  52. package/plugins/operator/between.js.map +1 -1
  53. package/plugins/operator/contains.js +5 -8
  54. package/plugins/operator/contains.js.map +1 -1
  55. package/plugins/operator/equal.js +4 -7
  56. package/plugins/operator/equal.js.map +1 -1
  57. package/plugins/operator/gt.js +4 -7
  58. package/plugins/operator/gt.js.map +1 -1
  59. package/plugins/operator/gte.js +4 -7
  60. package/plugins/operator/gte.js.map +1 -1
  61. package/plugins/operator/in.js +4 -7
  62. package/plugins/operator/in.js.map +1 -1
  63. package/plugins/operator/index.js +3 -1
  64. package/plugins/operator/index.js.map +1 -1
  65. package/plugins/operator/japanese/contains.js +7 -10
  66. package/plugins/operator/japanese/contains.js.map +1 -1
  67. package/plugins/operator/lt.js +4 -7
  68. package/plugins/operator/lt.js.map +1 -1
  69. package/plugins/operator/lte.js +4 -7
  70. package/plugins/operator/lte.js.map +1 -1
  71. package/plugins/operator/not.js +4 -7
  72. package/plugins/operator/not.js.map +1 -1
  73. package/plugins/operator/notBetween.js +4 -7
  74. package/plugins/operator/notBetween.js.map +1 -1
  75. package/plugins/operator/notContains.js +5 -8
  76. package/plugins/operator/notContains.js.map +1 -1
  77. package/plugins/operator/notIn.js +4 -7
  78. package/plugins/operator/notIn.js.map +1 -1
  79. package/plugins/operator/notStartsWith.js +7 -7
  80. package/plugins/operator/notStartsWith.js.map +1 -1
  81. package/plugins/operator/startsWith.js +7 -7
  82. package/plugins/operator/startsWith.js.map +1 -1
  83. package/sort.js +3 -1
  84. package/sort.js.map +1 -1
  85. package/types.js +3 -1
  86. package/types.js.map +1 -1
  87. package/utils/createIndex.d.ts +20 -0
  88. package/utils/createIndex.js +100 -0
  89. package/utils/createIndex.js.map +1 -0
  90. package/utils/index.d.ts +1 -0
  91. package/utils/index.js +18 -0
  92. package/utils/index.js.map +1 -0
  93. package/where.js +3 -1
  94. package/where.js.map +1 -1
package/client.d.ts CHANGED
@@ -2,4 +2,5 @@ import { Client, ClientOptions } from "@elastic/elasticsearch";
2
2
  export interface ElasticsearchClientOptions extends ClientOptions {
3
3
  endpoint?: string;
4
4
  }
5
+ export { Client, ClientOptions };
5
6
  export declare const createElasticsearchClient: (options: ElasticsearchClientOptions) => Client;
package/client.js CHANGED
@@ -4,40 +4,88 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
+ Object.defineProperty(exports, "Client", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _elasticsearch.Client;
11
+ }
12
+ });
13
+ Object.defineProperty(exports, "ClientOptions", {
14
+ enumerable: true,
15
+ get: function () {
16
+ return _elasticsearch.ClientOptions;
17
+ }
18
+ });
7
19
  exports.createElasticsearchClient = void 0;
8
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
- var _elasticsearch = require("@elastic/elasticsearch");
11
- var _awsSdk = _interopRequireDefault(require("aws-sdk"));
12
- var _error = _interopRequireDefault(require("@webiny/error"));
13
20
  var _awsElasticsearchConnector = _interopRequireDefault(require("aws-elasticsearch-connector"));
14
- const _excluded = ["endpoint", "node"];
21
+ var _crypto = _interopRequireDefault(require("crypto"));
22
+ var _error = _interopRequireDefault(require("@webiny/error"));
23
+ var _elasticsearch = require("@elastic/elasticsearch");
24
+ const clients = new Map();
25
+ const createClientKey = options => {
26
+ const key = JSON.stringify(options);
27
+ const hash = _crypto.default.createHash("sha1");
28
+ hash.update(key);
29
+ return hash.digest("hex");
30
+ };
15
31
  const createElasticsearchClient = options => {
16
- const {
17
- endpoint,
18
- node
19
- } = options,
20
- rest = (0, _objectWithoutProperties2.default)(options, _excluded);
21
- const clientOptions = (0, _objectSpread2.default)({
22
- node: endpoint || node
23
- }, rest);
24
- if (!clientOptions.auth) {
25
- /**
26
- * If no `auth` configuration is present, we setup AWS connector.
27
- */
28
- Object.assign(clientOptions, (0, _awsElasticsearchConnector.default)(_awsSdk.default.config));
29
- }
30
- try {
31
- return new _elasticsearch.Client(clientOptions);
32
- } catch (ex) {
33
- const data = (0, _objectSpread2.default)((0, _objectSpread2.default)({
34
- error: ex,
35
- node: endpoint || node
36
- }, rest), {}, {
37
- auth: undefined
38
- });
39
- console.log((0, _objectSpread2.default)({}, data));
40
- throw new _error.default("Could not connect to Elasticsearch.", "ELASTICSEARCH_CLIENT_ERROR", data);
32
+ const key = createClientKey(options);
33
+ const existing = clients.get(key);
34
+ if (existing) {
35
+ return existing;
41
36
  }
37
+ const cached = () => {
38
+ const {
39
+ endpoint,
40
+ node,
41
+ ...rest
42
+ } = options;
43
+ let clientOptions = {
44
+ node: endpoint || node,
45
+ ...rest
46
+ };
47
+ if (!clientOptions.auth) {
48
+ const region = String(process.env.AWS_REGION);
49
+ const credentials = {
50
+ accessKeyId: process.env.AWS_ACCESS_KEY_ID,
51
+ secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
52
+ sessionToken: process.env.AWS_SESSION_TOKEN
53
+ };
54
+ const errors = Object.keys(credentials).filter(key => {
55
+ const value = credentials[key];
56
+ return !value;
57
+ });
58
+ if (errors.length > 0) {
59
+ throw new _error.default(`Missing keys values: ${errors.join(", ")}`, "MISSING_AWS_CREDENTIALS");
60
+ }
61
+ clientOptions = {
62
+ ...clientOptions,
63
+ ...(0, _awsElasticsearchConnector.default)({
64
+ region,
65
+ // @ts-expect-error
66
+ credentials
67
+ })
68
+ };
69
+ }
70
+ try {
71
+ return new _elasticsearch.Client(clientOptions);
72
+ } catch (ex) {
73
+ const data = {
74
+ error: ex,
75
+ node: endpoint || node,
76
+ ...rest,
77
+ auth: undefined
78
+ };
79
+ console.log({
80
+ ...data
81
+ });
82
+ throw new _error.default("Could not connect to Elasticsearch.", "ELASTICSEARCH_CLIENT_ERROR", data);
83
+ }
84
+ };
85
+ const client = cached();
86
+ clients.set(key, client);
87
+ return client;
42
88
  };
43
- exports.createElasticsearchClient = createElasticsearchClient;
89
+ exports.createElasticsearchClient = createElasticsearchClient;
90
+
91
+ //# sourceMappingURL=client.js.map
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;AAA0E;AAMnE,MAAMA,yBAAyB,GAAIC,OAAmC,IAAK;EAC9E,MAAM;MAAEC,QAAQ;MAAEC;IAAc,CAAC,GAAGF,OAAO;IAAhBG,IAAI,0CAAKH,OAAO;EAE3C,MAAMI,aAA4B;IAC9BF,IAAI,EAAED,QAAQ,IAAIC;EAAI,GACnBC,IAAI,CACV;EAED,IAAI,CAACC,aAAa,CAACC,IAAI,EAAE;IACrB;AACR;AACA;IACQC,MAAM,CAACC,MAAM,CAACH,aAAa,EAAE,IAAAI,kCAA+B,EAACC,eAAG,CAACC,MAAM,CAAC,CAAC;EAC7E;EAEA,IAAI;IACA,OAAO,IAAIC,qBAAM,CAACP,aAAa,CAAC;EACpC,CAAC,CAAC,OAAOQ,EAAE,EAAE;IACT,MAAMC,IAAI;MACNC,KAAK,EAAEF,EAAE;MACTV,IAAI,EAAED,QAAQ,IAAIC;IAAI,GACnBC,IAAI;MACPE,IAAI,EAAEU;IAAS,EAClB;IACDC,OAAO,CAACC,GAAG,iCACJJ,IAAI,EACT;IACF,MAAM,IAAIK,cAAW,CACjB,qCAAqC,EACrC,4BAA4B,EAC5BL,IAAI,CACP;EACL;AACJ,CAAC;AAAC"}
1
+ {"version":3,"names":["_awsElasticsearchConnector","_interopRequireDefault","require","_crypto","_error","_elasticsearch","clients","Map","createClientKey","options","key","JSON","stringify","hash","crypto","createHash","update","digest","createElasticsearchClient","existing","get","cached","endpoint","node","rest","clientOptions","auth","region","String","process","env","AWS_REGION","credentials","accessKeyId","AWS_ACCESS_KEY_ID","secretAccessKey","AWS_SECRET_ACCESS_KEY","sessionToken","AWS_SESSION_TOKEN","errors","Object","keys","filter","value","length","WebinyError","join","createAwsElasticsearchConnector","Client","ex","data","error","undefined","console","log","client","set","exports"],"sources":["client.ts"],"sourcesContent":["import createAwsElasticsearchConnector from \"aws-elasticsearch-connector\";\nimport crypto from \"crypto\";\nimport WebinyError from \"@webiny/error\";\nimport { Client, ClientOptions } from \"@elastic/elasticsearch\";\n\nexport interface ElasticsearchClientOptions extends ClientOptions {\n endpoint?: string;\n}\n\nconst clients = new Map<string, Client>();\n\nconst createClientKey = (options: ElasticsearchClientOptions) => {\n const key = JSON.stringify(options);\n const hash = crypto.createHash(\"sha1\");\n hash.update(key);\n return hash.digest(\"hex\");\n};\n\nexport { Client, ClientOptions };\n\nexport const createElasticsearchClient = (options: ElasticsearchClientOptions): Client => {\n const key = createClientKey(options);\n const existing = clients.get(key);\n if (existing) {\n return existing;\n }\n\n const cached = (): Client => {\n const { endpoint, node, ...rest } = options;\n\n let clientOptions: ClientOptions = {\n node: endpoint || node,\n ...rest\n };\n\n if (!clientOptions.auth) {\n const region = String(process.env.AWS_REGION);\n\n const credentials = {\n accessKeyId: process.env.AWS_ACCESS_KEY_ID,\n secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,\n sessionToken: process.env.AWS_SESSION_TOKEN\n };\n\n const errors = Object.keys(credentials).filter(key => {\n const value = credentials[key as keyof typeof credentials];\n return !value;\n });\n if (errors.length > 0) {\n throw new WebinyError(\n `Missing keys values: ${errors.join(\", \")}`,\n \"MISSING_AWS_CREDENTIALS\"\n );\n }\n\n clientOptions = {\n ...clientOptions,\n ...createAwsElasticsearchConnector({\n region,\n // @ts-expect-error\n credentials\n })\n };\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\n const client = cached();\n\n clients.set(key, client);\n return client;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,0BAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,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AAO,CAACiC,KAAK;MACjB,CAAC,CAAC;MACF,IAAIJ,MAAM,CAACK,MAAM,GAAG,CAAC,EAAE;QACnB,MAAM,IAAIC,cAAW,CAChB,wBAAuBN,MAAM,CAACO,IAAI,CAAC,IAAI,CAAE,EAAC,EAC3C,yBACJ,CAAC;MACL;MAEArB,aAAa,GAAG;QACZ,GAAGA,aAAa;QAChB,GAAG,IAAAsB,kCAA+B,EAAC;UAC/BpB,MAAM;UACN;UACAK;QACJ,CAAC;MACL,CAAC;IACL;IAEA,IAAI;MACA,OAAO,IAAIgB,qBAAM,CAACvB,aAAa,CAAC;IACpC,CAAC,CAAC,OAAOwB,EAAE,EAAE;MACT,MAAMC,IAAI,GAAG;QACTC,KAAK,EAAEF,EAAE;QACT1B,IAAI,EAAED,QAAQ,IAAIC,IAAI;QACtB,GAAGC,IAAI;QACPE,IAAI,EAAE0B;MACV,CAAC;MACDC,OAAO,CAACC,GAAG,CAAC;QACR,GAAGJ;MACP,CAAC,CAAC;MACF,MAAM,IAAIL,cAAW,CACjB,qCAAqC,EACrC,4BAA4B,EAC5BK,IACJ,CAAC;IACL;EACJ,CAAC;EAED,MAAMK,MAAM,GAAGlC,MAAM,CAAC,CAAC;EAEvBf,OAAO,CAACkD,GAAG,CAAC9C,GAAG,EAAE6C,MAAM,CAAC;EACxB,OAAOA,MAAM;AACjB,CAAC;AAACE,OAAA,CAAAvC,yBAAA,GAAAA,yBAAA"}
package/compression.js CHANGED
@@ -17,7 +17,6 @@ const getCompressionPlugins = plugins => {
17
17
  const compress = async (pluginsContainer, data) => {
18
18
  const plugins = getCompressionPlugins(pluginsContainer);
19
19
  if (plugins.length === 0) {
20
- console.log("No compression plugins");
21
20
  return data;
22
21
  }
23
22
  for (const plugin of plugins) {
@@ -48,4 +47,6 @@ const decompress = async (pluginsContainer, data) => {
48
47
  */
49
48
  return data;
50
49
  };
51
- exports.decompress = decompress;
50
+ exports.decompress = decompress;
51
+
52
+ //# sourceMappingURL=compression.js.map
@@ -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":";;;;;;AAAA;AAGA;AACA;AACA;AACA,MAAMA,qBAAqB,GAAIC,OAAyB,IAA0B;EAC9E,OAAOA,OAAO,CAACC,MAAM,CAAoBC,oCAAiB,CAACC,IAAI,CAAC,CAACC,OAAO,EAAE;AAC9E,CAAC;AACD;AACA;AACA;AACO,MAAMC,QAAQ,GAAG,OACpBC,gBAAkC,EAClCC,IAAyB,KACM;EAC/B,MAAMP,OAAO,GAAGD,qBAAqB,CAACO,gBAAgB,CAAC;EACvD,IAAIN,OAAO,CAACQ,MAAM,KAAK,CAAC,EAAE;IACtBC,OAAO,CAACC,GAAG,CAAC,wBAAwB,CAAC;IACrC,OAAOH,IAAI;EACf;EACA,KAAK,MAAMI,MAAM,IAAIX,OAAO,EAAE;IAC1B,IAAIW,MAAM,CAACC,WAAW,CAACL,IAAI,CAAC,KAAK,KAAK,EAAE;MACpC;IACJ;IACA,OAAO,MAAMI,MAAM,CAACN,QAAQ,CAACE,IAAI,CAAC;EACtC;EACA;AACJ;AACA;EACI,OAAOA,IAAI;AACf,CAAC;AAAC;AAEK,MAAMM,UAAU,GAAG,OACtBP,gBAAkC,EAClCC,IAAyB,KACM;EAC/B,MAAMP,OAAO,GAAGD,qBAAqB,CAACO,gBAAgB,CAAC;EACvD,IAAIN,OAAO,CAACQ,MAAM,KAAK,CAAC,EAAE;IACtB,OAAOD,IAAI;EACf;EACA,KAAK,MAAMI,MAAM,IAAIX,OAAO,EAAE;IAC1B,IAAIW,MAAM,CAACG,aAAa,CAACP,IAAI,CAAC,KAAK,KAAK,EAAE;MACtC;IACJ;IACA,OAAO,MAAMI,MAAM,CAACE,UAAU,CAACN,IAAI,CAAC;EACxC;EACA;AACJ;AACA;EACI,OAAOA,IAAI;AACf,CAAC;AAAC"}
1
+ {"version":3,"names":["_CompressionPlugin","require","getCompressionPlugins","plugins","byType","CompressionPlugin","type","reverse","compress","pluginsContainer","data","length","plugin","canCompress","exports","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 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,IAAAA,kBAAA,GAAAC,OAAA;AAGA;AACA;AACA;AACA,MAAMC,qBAAqB,GAAIC,OAAyB,IAA0B;EAC9E,OAAOA,OAAO,CAACC,MAAM,CAAoBC,oCAAiB,CAACC,IAAI,CAAC,CAACC,OAAO,CAAC,CAAC;AAC9E,CAAC;AACD;AACA;AACA;AACO,MAAMC,QAAQ,GAAG,MAAAA,CACpBC,gBAAkC,EAClCC,IAAyB,KACM;EAC/B,MAAMP,OAAO,GAAGD,qBAAqB,CAACO,gBAAgB,CAAC;EACvD,IAAIN,OAAO,CAACQ,MAAM,KAAK,CAAC,EAAE;IACtB,OAAOD,IAAI;EACf;EACA,KAAK,MAAME,MAAM,IAAIT,OAAO,EAAE;IAC1B,IAAIS,MAAM,CAACC,WAAW,CAACH,IAAI,CAAC,KAAK,KAAK,EAAE;MACpC;IACJ;IACA,OAAO,MAAME,MAAM,CAACJ,QAAQ,CAACE,IAAI,CAAC;EACtC;EACA;AACJ;AACA;EACI,OAAOA,IAAI;AACf,CAAC;AAACI,OAAA,CAAAN,QAAA,GAAAA,QAAA;AAEK,MAAMO,UAAU,GAAG,MAAAA,CACtBN,gBAAkC,EAClCC,IAAyB,KACM;EAC/B,MAAMP,OAAO,GAAGD,qBAAqB,CAACO,gBAAgB,CAAC;EACvD,IAAIN,OAAO,CAACQ,MAAM,KAAK,CAAC,EAAE;IACtB,OAAOD,IAAI;EACf;EACA,KAAK,MAAME,MAAM,IAAIT,OAAO,EAAE;IAC1B,IAAIS,MAAM,CAACI,aAAa,CAACN,IAAI,CAAC,KAAK,KAAK,EAAE;MACtC;IACJ;IACA,OAAO,MAAME,MAAM,CAACG,UAAU,CAACL,IAAI,CAAC;EACxC;EACA;AACJ;AACA;EACI,OAAOA,IAAI;AACf,CAAC;AAACI,OAAA,CAAAC,UAAA,GAAAA,UAAA"}
package/cursors.js CHANGED
@@ -40,4 +40,6 @@ const decodeCursor = cursor => {
40
40
  }
41
41
  return undefined;
42
42
  };
43
- exports.decodeCursor = decodeCursor;
43
+ exports.decodeCursor = decodeCursor;
44
+
45
+ //# sourceMappingURL=cursors.js.map
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","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,MAAiC,IAAyB;EACnF,IAAI,CAACA,MAAM,EAAE;IACT,OAAOC,SAAS;EACpB;EAEAD,MAAM,GAAGE,KAAK,CAACC,OAAO,CAACH,MAAM,CAAC,GAAGA,MAAM,CAACI,GAAG,CAACC,kBAAkB,CAAC,GAAGA,kBAAkB,CAACL,MAAM,CAAC;EAE5F,IAAI;IACA,OAAOM,MAAM,CAACC,IAAI,CAACC,IAAI,CAACC,SAAS,CAACT,MAAM,CAAC,CAAC,CAACU,QAAQ,CAAC,QAAQ,CAAC;EACjE,CAAC,CAAC,OAAOC,EAAE,EAAE;IACTC,OAAO,CAACC,KAAK,CAACF,EAAE,CAACG,OAAO,CAAC;EAC7B;EACA,OAAOb,SAAS;AACpB,CAAC;AACD;AACA;AACA;AACA;AAHA;AAIO,MAAMc,YAAY,GAAIf,MAAsB,IAAmC;EAClF,IAAI,CAACA,MAAM,EAAE;IACT,OAAOC,SAAS;EACpB;EACA,IAAI;IACA,MAAMe,KAAK,GAAGR,IAAI,CAACS,KAAK,CAACX,MAAM,CAACC,IAAI,CAACP,MAAM,EAAE,QAAQ,CAAC,CAACU,QAAQ,CAAC,OAAO,CAAC,CAAC;IACzE,IAAIR,KAAK,CAACC,OAAO,CAACa,KAAK,CAAC,EAAE;MACtB,OAAOA,KAAK,CAACZ,GAAG,CAACc,kBAAkB,CAAC;IACxC;IACA,MAAMC,OAAO,GAAGD,kBAAkB,CAACF,KAAK,CAAC;IACzC,OAAOG,OAAO,GAAG,CAACA,OAAO,CAAC,GAAGlB,SAAS;EAC1C,CAAC,CAAC,OAAOU,EAAE,EAAE;IACTC,OAAO,CAACC,KAAK,CAACF,EAAE,CAACG,OAAO,CAAC;EAC7B;EACA,OAAOb,SAAS;AACpB,CAAC;AAAC"}
1
+ {"version":3,"names":["encodeCursor","cursor","undefined","Array","isArray","map","encodeURIComponent","Buffer","from","JSON","stringify","toString","ex","console","error","message","exports","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,MAAiC,IAAyB;EACnF,IAAI,CAACA,MAAM,EAAE;IACT,OAAOC,SAAS;EACpB;EAEAD,MAAM,GAAGE,KAAK,CAACC,OAAO,CAACH,MAAM,CAAC,GAAGA,MAAM,CAACI,GAAG,CAACC,kBAAkB,CAAC,GAAGA,kBAAkB,CAACL,MAAM,CAAC;EAE5F,IAAI;IACA,OAAOM,MAAM,CAACC,IAAI,CAACC,IAAI,CAACC,SAAS,CAACT,MAAM,CAAC,CAAC,CAACU,QAAQ,CAAC,QAAQ,CAAC;EACjE,CAAC,CAAC,OAAOC,EAAE,EAAE;IACTC,OAAO,CAACC,KAAK,CAACF,EAAE,CAACG,OAAO,CAAC;EAC7B;EACA,OAAOb,SAAS;AACpB,CAAC;AACD;AACA;AACA;AACA;AAHAc,OAAA,CAAAhB,YAAA,GAAAA,YAAA;AAIO,MAAMiB,YAAY,GAAIhB,MAAsB,IAAmC;EAClF,IAAI,CAACA,MAAM,EAAE;IACT,OAAOC,SAAS;EACpB;EACA,IAAI;IACA,MAAMgB,KAAK,GAAGT,IAAI,CAACU,KAAK,CAACZ,MAAM,CAACC,IAAI,CAACP,MAAM,EAAE,QAAQ,CAAC,CAACU,QAAQ,CAAC,OAAO,CAAC,CAAC;IACzE,IAAIR,KAAK,CAACC,OAAO,CAACc,KAAK,CAAC,EAAE;MACtB,OAAOA,KAAK,CAACb,GAAG,CAACe,kBAAkB,CAAC;IACxC;IACA,MAAMC,OAAO,GAAGD,kBAAkB,CAACF,KAAK,CAAC;IACzC,OAAOG,OAAO,GAAG,CAACA,OAAO,CAAC,GAAGnB,SAAS;EAC1C,CAAC,CAAC,OAAOU,EAAE,EAAE;IACTC,OAAO,CAACC,KAAK,CAACF,EAAE,CAACG,OAAO,CAAC;EAC7B;EACA,OAAOb,SAAS;AACpB,CAAC;AAACc,OAAA,CAAAC,YAAA,GAAAA,YAAA"}
package/index.d.ts CHANGED
@@ -13,6 +13,7 @@ export * from "./compression";
13
13
  export * from "./operators";
14
14
  export * from "./cursors";
15
15
  export * from "./client";
16
+ export * from "./utils";
16
17
  export { createGzipCompression } from "./plugins/GzipCompression";
17
18
  /**
18
19
  * We must accept either Elasticsearch client or options that create the client.
package/index.js CHANGED
@@ -149,6 +149,18 @@ Object.keys(_cursors).forEach(function (key) {
149
149
  }
150
150
  });
151
151
  });
152
+ var _utils = require("./utils");
153
+ Object.keys(_utils).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] === _utils[key]) return;
157
+ Object.defineProperty(exports, key, {
158
+ enumerable: true,
159
+ get: function () {
160
+ return _utils[key];
161
+ }
162
+ });
163
+ });
152
164
  var _GzipCompression = require("./plugins/GzipCompression");
153
165
  /**
154
166
  * TODO File should contain only exports from other files.
@@ -168,4 +180,6 @@ var _default = params => {
168
180
  context.plugins.register((0, _operators.getElasticsearchOperators)());
169
181
  });
170
182
  };
171
- exports.default = _default;
183
+ exports.default = _default;
184
+
185
+ //# sourceMappingURL=index.js.map
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":";;;;;;;;;;;;;;;;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;AAFA,eAIIA,MAA2C,IACL;EACtC,OAAO,IAAIC,kBAAa,CAAuBC,OAAO,IAAI;IACtD,IAAIA,OAAO,CAACC,aAAa,EAAE;MACvB,MAAM,IAAIC,cAAW,CACjB,yHAAyH,EACzH,mCAAmC,CACtC;IACL;IACA;AACR;AACA;IACQF,OAAO,CAACC,aAAa,GACjBH,MAAM,YAAYK,qBAAM,GAAGL,MAAM,GAAG,IAAAM,iCAAyB,EAACN,MAAM,CAAC;IAEzEE,OAAO,CAACK,OAAO,CAACC,QAAQ,CAAC,IAAAC,oCAAyB,GAAE,CAAC;EACzD,CAAC,CAAC;AACN,CAAC;AAAA"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_api","_client","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_operators","_elasticsearch","_indexConfiguration","_plugins","_sort","_indices","_where","_limit","_normalize","_compression","_cursors","_utils","_GzipCompression","_default","params","ContextPlugin","context","elasticsearch","WebinyError","Client","createElasticsearchClient","plugins","register","getElasticsearchOperators","default"],"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 * from \"./utils\";\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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAcAG,MAAA,CAAAC,IAAA,CAAAF,OAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAA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MAAA,EAAArB,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAoB,MAAA,CAAApB,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAY,MAAA,CAAApB,GAAA;IAAA;EAAA;AAAA;AACA,IAAAqB,gBAAA,GAAA3B,OAAA;AAtBA;AACA;AACA;AAsBA;AACA;AACA;AAFA,IAAA4B,QAAA,GAIIC,MAA2C,IACL;EACtC,OAAO,IAAIC,kBAAa,CAAuBC,OAAO,IAAI;IACtD,IAAIA,OAAO,CAACC,aAAa,EAAE;MACvB,MAAM,IAAIC,cAAW,CACjB,yHAAyH,EACzH,mCACJ,CAAC;IACL;IACA;AACR;AACA;IACQF,OAAO,CAACC,aAAa,GACjBH,MAAM,YAAYK,qBAAM,GAAGL,MAAM,GAAG,IAAAM,iCAAyB,EAACN,MAAM,CAAC;IAEzEE,OAAO,CAACK,OAAO,CAACC,QAAQ,CAAC,IAAAC,oCAAyB,EAAC,CAAC,CAAC;EACzD,CAAC,CAAC;AACN,CAAC;AAAA3B,OAAA,CAAA4B,OAAA,GAAAX,QAAA"}
@@ -37,4 +37,6 @@ const getBaseConfiguration = modifier => {
37
37
  }
38
38
  return modifier(config);
39
39
  };
40
- exports.getBaseConfiguration = getBaseConfiguration;
40
+ exports.getBaseConfiguration = getBaseConfiguration;
41
+
42
+ //# sourceMappingURL=base.js.map
@@ -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":";;;;;;AACA;AAEA,MAAMA,MAAqC,GAAG;EAC1CC,QAAQ,EAAE;IACNC,iBAAiB,EAAE,IAAAC,yBAAiB,EAACF,QAAQ,IAAI;MAC7C,OAAOA,QAAQ,CAACG,MAAM,CAAC,CACnB;QACIC,OAAO,EAAE;UACLC,kBAAkB,EAAE,QAAQ;UAC5BC,OAAO,EAAE;YACLC,IAAI,EAAE,MAAM;YACZC,MAAM,EAAE;cACJC,OAAO,EAAE;gBACLF,IAAI,EAAE,SAAS;gBACfG,YAAY,EAAE;cAClB;YACJ;UACJ;QACJ;MACJ,CAAC,CACJ,CAAC;IACN,CAAC,CAAC;IACFC,UAAU,EAAE;MACRC,SAAS,EAAE;QACPL,IAAI,EAAE,QAAQ;QACdM,OAAO,EAAE;MACb;IACJ;EACJ;AACJ,CAAC;AAKM,MAAMC,oBAAoB,GAAIC,QAAmB,IAAK;EACzD,IAAI,CAACA,QAAQ,EAAE;IACX,OAAOhB,MAAM;EACjB;EACA,OAAOgB,QAAQ,CAAChB,MAAM,CAAC;AAC3B,CAAC;AAAC"}
1
+ {"version":3,"names":["_common","require","config","mappings","dynamic_templates","getCommonMappings","concat","strings","match_mapping_type","mapping","type","fields","keyword","ignore_above","properties","rawValues","enabled","getBaseConfiguration","modifier","exports"],"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,IAAAA,OAAA,GAAAC,OAAA;AAEA,MAAMC,MAAqC,GAAG;EAC1CC,QAAQ,EAAE;IACNC,iBAAiB,EAAE,IAAAC,yBAAiB,EAACF,QAAQ,IAAI;MAC7C,OAAOA,QAAQ,CAACG,MAAM,CAAC,CACnB;QACIC,OAAO,EAAE;UACLC,kBAAkB,EAAE,QAAQ;UAC5BC,OAAO,EAAE;YACLC,IAAI,EAAE,MAAM;YACZC,MAAM,EAAE;cACJC,OAAO,EAAE;gBACLF,IAAI,EAAE,SAAS;gBACfG,YAAY,EAAE;cAClB;YACJ;UACJ;QACJ;MACJ,CAAC,CACJ,CAAC;IACN,CAAC,CAAC;IACFC,UAAU,EAAE;MACRC,SAAS,EAAE;QACPL,IAAI,EAAE,QAAQ;QACdM,OAAO,EAAE;MACb;IACJ;EACJ;AACJ,CAAC;AAKM,MAAMC,oBAAoB,GAAIC,QAAmB,IAAK;EACzD,IAAI,CAACA,QAAQ,EAAE;IACX,OAAOhB,MAAM;EACjB;EACA,OAAOgB,QAAQ,CAAChB,MAAM,CAAC;AAC3B,CAAC;AAACiB,OAAA,CAAAF,oBAAA,GAAAA,oBAAA"}
@@ -38,4 +38,6 @@ const getCommonMappings = cb => {
38
38
  }
39
39
  return cb(getDefaultMappings());
40
40
  };
41
- exports.getCommonMappings = getCommonMappings;
41
+ exports.getCommonMappings = getCommonMappings;
42
+
43
+ //# sourceMappingURL=common.js.map
@@ -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":";;;;;;AAEA,MAAMA,kBAAkB,GAAG,MAA8D;EACrF,OAAO,CACH;IACIC,KAAK,EAAE;MACHC,KAAK,EAAE,iCAAiC;MACxCC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV;IACJ;EACJ,CAAC,EACD;IACIC,OAAO,EAAE;MACLH,KAAK,EAAE,UAAU;MACjBC,OAAO,EAAE;QACLC,IAAI,EAAE,cAAc;QACpBE,cAAc,EAAE;MACpB;IACJ;EACJ,CAAC,EACD;IACIC,QAAQ,EAAE;MACNL,KAAK,EAAE,WAAW;MAClBC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV;IACJ;EACJ,CAAC,CACJ;AACL,CAAC;AAOD;AACA;AACA;AACO,MAAMI,iBAAiB,GAC1BC,EAAa,IAC4C;EACzD,IAAI,CAACA,EAAE,EAAE;IACL,OAAOT,kBAAkB,EAAE;EAC/B;EAEA,OAAOS,EAAE,CAACT,kBAAkB,EAAE,CAAC;AACnC,CAAC;AAAC"}
1
+ {"version":3,"names":["getDefaultMappings","dates","match","mapping","type","numbers","scaling_factor","booleans","getCommonMappings","cb","exports"],"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,GAAGA,CAAA,KAA8D;EACrF,OAAO,CACH;IACIC,KAAK,EAAE;MACHC,KAAK,EAAE,iCAAiC;MACxCC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV;IACJ;EACJ,CAAC,EACD;IACIC,OAAO,EAAE;MACLH,KAAK,EAAE,UAAU;MACjBC,OAAO,EAAE;QACLC,IAAI,EAAE,cAAc;QACpBE,cAAc,EAAE;MACpB;IACJ;EACJ,CAAC,EACD;IACIC,QAAQ,EAAE;MACNL,KAAK,EAAE,WAAW;MAClBC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV;IACJ;EACJ,CAAC,CACJ;AACL,CAAC;AAOD;AACA;AACA;AACO,MAAMI,iBAAiB,GAC1BC,EAAa,IAC4C;EACzD,IAAI,CAACA,EAAE,EAAE;IACL,OAAOT,kBAAkB,CAAC,CAAC;EAC/B;EAEA,OAAOS,EAAE,CAACT,kBAAkB,CAAC,CAAC,CAAC;AACnC,CAAC;AAACU,OAAA,CAAAF,iBAAA,GAAAA,iBAAA"}
@@ -35,4 +35,6 @@ Object.keys(_japanese).forEach(function (key) {
35
35
  return _japanese[key];
36
36
  }
37
37
  });
38
- });
38
+ });
39
+
40
+ //# sourceMappingURL=index.js.map
@@ -1 +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
+ {"version":3,"names":["_base","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_common","_japanese"],"sources":["index.ts"],"sourcesContent":["export * from \"./base\";\nexport * from \"./common\";\nexport * from \"./japanese\";\n"],"mappings":";;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,KAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,KAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,KAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,OAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,OAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,OAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,OAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,SAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,SAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,SAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,SAAA,CAAAN,GAAA;IAAA;EAAA;AAAA"}
@@ -116,4 +116,6 @@ const getJapaneseConfiguration = modifier => {
116
116
  }
117
117
  return modifier(config);
118
118
  };
119
- exports.getJapaneseConfiguration = getJapaneseConfiguration;
119
+ exports.getJapaneseConfiguration = getJapaneseConfiguration;
120
+
121
+ //# sourceMappingURL=japanese.js.map
@@ -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":";;;;;;AACA;AAEA,MAAMA,MAAqC,GAAG;EAC1CC,QAAQ,EAAE;IACNC,KAAK,EAAE;MACHC,QAAQ,EAAE;QACNC,WAAW,EAAE;UACTC,SAAS,EAAE;YACPC,IAAI,EAAE,gBAAgB;YACtBC,IAAI,EAAE,MAAM;YACZC,IAAI,EAAE;UACV;QACJ,CAAC;QACDC,SAAS,EAAE;UACPC,qBAAqB,EAAE;YACnBF,IAAI,EAAE,QAAQ;YACdF,IAAI,EAAE,oBAAoB;YAC1BK,sBAAsB,EAAE,MAAM;YAC9BC,qBAAqB,EAAE,CACnB,wCAAwC;UAEhD,CAAC;UACDC,kBAAkB,EAAE;YAChBP,IAAI,EAAE,OAAO;YACbQ,QAAQ,EAAE,GAAG;YACbC,QAAQ,EAAE,GAAG;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E;QACV;MACJ;IACJ;EACJ,CAAC;EACDuB,QAAQ,EAAE;IACNC,iBAAiB,EAAE,IAAI;IACvBC,iBAAiB,EAAE,IAAAC,yBAAiB,EAACH,QAAQ,IAAI;MAC7C,OAAOA,QAAQ,CAACI,MAAM,CAAC,CACnB;QACIC,OAAO,EAAE;UACLC,kBAAkB,EAAE,QAAQ;UAC5BC,OAAO,EAAE;YACL9B,IAAI,EAAE,MAAM;YACZ+B,eAAe,EAAE,6BAA6B;YAC9Cf,QAAQ,EAAE,4BAA4B;YACtCgB,MAAM,EAAE;cACJC,KAAK,EAAE;gBACHjC,IAAI,EAAE,MAAM;gBACZ+B,eAAe,EAAE,0BAA0B;gBAC3Cf,QAAQ,EAAE;cACd,CAAC;cACDkB,OAAO,EAAE;gBACLC,YAAY,EAAE,GAAG;gBACjBnC,IAAI,EAAE;cACV;YACJ;UACJ;QACJ;MACJ,CAAC,CACJ,CAAC;IACN,CAAC,CAAC;IACFoC,UAAU,EAAE;MACRC,SAAS,EAAE;QACPrC,IAAI,EAAE,QAAQ;QACdsC,OAAO,EAAE;MACb;IACJ;EACJ;AACJ,CAAC;AAKM,MAAMC,wBAAwB,GAAIC,QAAmB,IAAK;EAC7D,IAAI,CAACA,QAAQ,EAAE;IACX,OAAO9C,MAAM;EACjB;EACA,OAAO8C,QAAQ,CAAC9C,MAAM,CAAC;AAC3B,CAAC;AAAC"}
1
+ {"version":3,"names":["_common","require","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","exports"],"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":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AAEA,MAAMC,MAAqC,GAAG;EAC1CC,QAAQ,EAAE;IACNC,KAAK,EAAE;MACHC,QAAQ,EAAE;QACNC,WAAW,EAAE;UACTC,SAAS,EAAE;YACPC,IAAI,EAAE,gBAAgB;YACtBC,IAAI,EAAE,MAAM;YACZC,IAAI,EAAE;UACV;QACJ,CAAC;QACDC,SAAS,EAAE;UACPC,qBAAqB,EAAE;YACnBF,IAAI,EAAE,QAAQ;YACdF,IAAI,EAAE,oBAAoB;YAC1BK,sBAAsB,EAAE,MAAM;YAC9BC,qBAAqB,EAAE,CACnB,wCAAwC;UAEhD,CAAC;UACDC,kBAAkB,EAAE;YAChBP,IAAI,EAAE,OAAO;YACbQ,QAAQ,EAAE,GAAG;YACbC,QAAQ,EAAE,GAAG;YACbC,WAAW,EAAE,CAAC,QAAQ,EAAE,OAAO;UAC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EAAE;IACNC,iBAAiB,EAAE,IAAI;IACvBC,iBAAiB,EAAE,IAAAC,yBAAiB,EAACH,QAAQ,IAAI;MAC7C,OAAOA,QAAQ,CAACI,MAAM,CAAC,CACnB;QACIC,OAAO,EAAE;UACLC,kBAAkB,EAAE,QAAQ;UAC5BC,OAAO,EAAE;YACL9B,IAAI,EAAE,MAAM;YACZ+B,eAAe,EAAE,6BAA6B;YAC9Cf,QAAQ,EAAE,4BAA4B;YACtCgB,MAAM,EAAE;cACJC,KAAK,EAAE;gBACHjC,IAAI,EAAE,MAAM;gBACZ+B,eAAe,EAAE,0BAA0B;gBAC3Cf,QAAQ,EAAE;cACd,CAAC;cACDkB,OAAO,EAAE;gBACLC,YAAY,EAAE,GAAG;gBACjBnC,IAAI,EAAE;cACV;YACJ;UACJ;QACJ;MACJ,CAAC,CACJ,CAAC;IACN,CAAC,CAAC;IACFoC,UAAU,EAAE;MACRC,SAAS,EAAE;QACPrC,IAAI,EAAE,QAAQ;QACdsC,OAAO,EAAE;MACb;IACJ;EACJ;AACJ,CAAC;AAKM,MAAMC,wBAAwB,GAAIC,QAAmB,IAAK;EAC7D,IAAI,CAACA,QAAQ,EAAE;IACX,OAAO9C,MAAM;EACjB;EACA,OAAO8C,QAAQ,CAAC9C,MAAM,CAAC;AAC3B,CAAC;AAAC+C,OAAA,CAAAF,wBAAA,GAAAA,wBAAA"}
package/indices.js CHANGED
@@ -25,4 +25,6 @@ const getLastAddedIndexPlugin = params => {
25
25
  }
26
26
  return plugins.pop();
27
27
  };
28
- exports.getLastAddedIndexPlugin = getLastAddedIndexPlugin;
28
+ exports.getLastAddedIndexPlugin = getLastAddedIndexPlugin;
29
+
30
+ //# sourceMappingURL=indices.js.map
package/indices.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["listIndicesPlugins","container","type","locale","byType","filter","plugin","canUse","getLastAddedIndexPlugin","params","plugins","length","WebinyError","pop"],"sources":["indices.ts"],"sourcesContent":["import { ElasticsearchIndexPlugin } from \"~/plugins/definition/ElasticsearchIndexPlugin\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport WebinyError from \"@webiny/error\";\n\ninterface IndicesPluginsParams {\n container: PluginsContainer;\n type: string;\n locale: string;\n}\nconst listIndicesPlugins = <T extends ElasticsearchIndexPlugin>({\n container,\n type,\n locale\n}: IndicesPluginsParams): T[] => {\n return container.byType<T>(type).filter(plugin => {\n return plugin.canUse(locale);\n });\n};\n\nexport const getLastAddedIndexPlugin = <T extends ElasticsearchIndexPlugin>(\n params: IndicesPluginsParams\n): T => {\n const plugins = listIndicesPlugins<T>(params);\n if (plugins.length === 0) {\n throw new WebinyError(\n `Could not find a single ElasticsearchIndexPlugin of type \"${params.type}\".`,\n \"ELASTICSEARCH_INDEX_TEMPLATE_ERROR\",\n {\n type: params.type,\n locale: params.locale\n }\n );\n }\n\n return plugins.pop() as T;\n};\n"],"mappings":";;;;;;;AAEA;AAOA,MAAMA,kBAAkB,GAAG,CAAqC;EAC5DC,SAAS;EACTC,IAAI;EACJC;AACkB,CAAC,KAAU;EAC7B,OAAOF,SAAS,CAACG,MAAM,CAAIF,IAAI,CAAC,CAACG,MAAM,CAACC,MAAM,IAAI;IAC9C,OAAOA,MAAM,CAACC,MAAM,CAACJ,MAAM,CAAC;EAChC,CAAC,CAAC;AACN,CAAC;AAEM,MAAMK,uBAAuB,GAChCC,MAA4B,IACxB;EACJ,MAAMC,OAAO,GAAGV,kBAAkB,CAAIS,MAAM,CAAC;EAC7C,IAAIC,OAAO,CAACC,MAAM,KAAK,CAAC,EAAE;IACtB,MAAM,IAAIC,cAAW,CAChB,6DAA4DH,MAAM,CAACP,IAAK,IAAG,EAC5E,oCAAoC,EACpC;MACIA,IAAI,EAAEO,MAAM,CAACP,IAAI;MACjBC,MAAM,EAAEM,MAAM,CAACN;IACnB,CAAC,CACJ;EACL;EAEA,OAAOO,OAAO,CAACG,GAAG,EAAE;AACxB,CAAC;AAAC"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","listIndicesPlugins","container","type","locale","byType","filter","plugin","canUse","getLastAddedIndexPlugin","params","plugins","length","WebinyError","pop","exports"],"sources":["indices.ts"],"sourcesContent":["import { ElasticsearchIndexPlugin } from \"~/plugins/definition/ElasticsearchIndexPlugin\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport WebinyError from \"@webiny/error\";\n\ninterface IndicesPluginsParams {\n container: PluginsContainer;\n type: string;\n locale: string;\n}\nconst listIndicesPlugins = <T extends ElasticsearchIndexPlugin>({\n container,\n type,\n locale\n}: IndicesPluginsParams): T[] => {\n return container.byType<T>(type).filter(plugin => {\n return plugin.canUse(locale);\n });\n};\n\nexport const getLastAddedIndexPlugin = <T extends ElasticsearchIndexPlugin>(\n params: IndicesPluginsParams\n): T => {\n const plugins = listIndicesPlugins<T>(params);\n if (plugins.length === 0) {\n throw new WebinyError(\n `Could not find a single ElasticsearchIndexPlugin of type \"${params.type}\".`,\n \"ELASTICSEARCH_INDEX_TEMPLATE_ERROR\",\n {\n type: params.type,\n locale: params.locale\n }\n );\n }\n\n return plugins.pop() as T;\n};\n"],"mappings":";;;;;;;AAEA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAOA,MAAMC,kBAAkB,GAAGA,CAAqC;EAC5DC,SAAS;EACTC,IAAI;EACJC;AACkB,CAAC,KAAU;EAC7B,OAAOF,SAAS,CAACG,MAAM,CAAIF,IAAI,CAAC,CAACG,MAAM,CAACC,MAAM,IAAI;IAC9C,OAAOA,MAAM,CAACC,MAAM,CAACJ,MAAM,CAAC;EAChC,CAAC,CAAC;AACN,CAAC;AAEM,MAAMK,uBAAuB,GAChCC,MAA4B,IACxB;EACJ,MAAMC,OAAO,GAAGV,kBAAkB,CAAIS,MAAM,CAAC;EAC7C,IAAIC,OAAO,CAACC,MAAM,KAAK,CAAC,EAAE;IACtB,MAAM,IAAIC,cAAW,CAChB,6DAA4DH,MAAM,CAACP,IAAK,IAAG,EAC5E,oCAAoC,EACpC;MACIA,IAAI,EAAEO,MAAM,CAACP,IAAI;MACjBC,MAAM,EAAEM,MAAM,CAACN;IACnB,CACJ,CAAC;EACL;EAEA,OAAOO,OAAO,CAACG,GAAG,CAAC,CAAC;AACxB,CAAC;AAACC,OAAA,CAAAN,uBAAA,GAAAA,uBAAA"}
package/limit.js CHANGED
@@ -34,4 +34,6 @@ const createLimit = (limit, defaultValue = ES_LIMIT_DEFAULT) => {
34
34
  */
35
35
  return ES_LIMIT_MAX - 1;
36
36
  };
37
- exports.createLimit = createLimit;
37
+ exports.createLimit = createLimit;
38
+
39
+ //# sourceMappingURL=limit.js.map
package/limit.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["ES_LIMIT_MAX","ES_LIMIT_DEFAULT","createLimit","limit","defaultValue"],"sources":["limit.ts"],"sourcesContent":["/**\n * This is the max limit of the Elasticsearch.\n * Change here if it changes (and if it is necessary).\n */\nconst ES_LIMIT_MAX = 10000;\n/**\n * Our system default limit.\n */\nconst ES_LIMIT_DEFAULT = 50;\n\nexport const createLimit = (limit?: number, defaultValue = ES_LIMIT_DEFAULT): number => {\n /**\n * Limit can possibly be null/undefined or less than 1.\n * In that case return the defaults.\n */\n if (!limit || limit < 1) {\n return defaultValue;\n }\n /**\n * Users input limit cannot be greater than the Elasticsearch one.\n * Elasticsearch query breaks because of that.\n */\n if (limit < ES_LIMIT_MAX) {\n return limit;\n }\n /**\n * Always reduce by 1 because we check if there are more items by adding 1 to the limit\n * and then remove that last one loaded.\n */\n return ES_LIMIT_MAX - 1;\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA,MAAMA,YAAY,GAAG,KAAK;AAC1B;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG,EAAE;AAEpB,MAAMC,WAAW,GAAG,CAACC,KAAc,EAAEC,YAAY,GAAGH,gBAAgB,KAAa;EACpF;AACJ;AACA;AACA;EACI,IAAI,CAACE,KAAK,IAAIA,KAAK,GAAG,CAAC,EAAE;IACrB,OAAOC,YAAY;EACvB;EACA;AACJ;AACA;AACA;EACI,IAAID,KAAK,GAAGH,YAAY,EAAE;IACtB,OAAOG,KAAK;EAChB;EACA;AACJ;AACA;AACA;EACI,OAAOH,YAAY,GAAG,CAAC;AAC3B,CAAC;AAAC"}
1
+ {"version":3,"names":["ES_LIMIT_MAX","ES_LIMIT_DEFAULT","createLimit","limit","defaultValue","exports"],"sources":["limit.ts"],"sourcesContent":["/**\n * This is the max limit of the Elasticsearch.\n * Change here if it changes (and if it is necessary).\n */\nconst ES_LIMIT_MAX = 10000;\n/**\n * Our system default limit.\n */\nconst ES_LIMIT_DEFAULT = 50;\n\nexport const createLimit = (limit?: number, defaultValue = ES_LIMIT_DEFAULT): number => {\n /**\n * Limit can possibly be null/undefined or less than 1.\n * In that case return the defaults.\n */\n if (!limit || limit < 1) {\n return defaultValue;\n }\n /**\n * Users input limit cannot be greater than the Elasticsearch one.\n * Elasticsearch query breaks because of that.\n */\n if (limit < ES_LIMIT_MAX) {\n return limit;\n }\n /**\n * Always reduce by 1 because we check if there are more items by adding 1 to the limit\n * and then remove that last one loaded.\n */\n return ES_LIMIT_MAX - 1;\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA,MAAMA,YAAY,GAAG,KAAK;AAC1B;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG,EAAE;AAEpB,MAAMC,WAAW,GAAGA,CAACC,KAAc,EAAEC,YAAY,GAAGH,gBAAgB,KAAa;EACpF;AACJ;AACA;AACA;EACI,IAAI,CAACE,KAAK,IAAIA,KAAK,GAAG,CAAC,EAAE;IACrB,OAAOC,YAAY;EACvB;EACA;AACJ;AACA;AACA;EACI,IAAID,KAAK,GAAGH,YAAY,EAAE;IACtB,OAAOG,KAAK;EAChB;EACA;AACJ;AACA;AACA;EACI,OAAOH,YAAY,GAAG,CAAC;AAC3B,CAAC;AAACK,OAAA,CAAAH,WAAA,GAAAA,WAAA"}
package/normalize.d.ts CHANGED
@@ -3,3 +3,4 @@
3
3
  * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#_reserved_characters
4
4
  */
5
5
  export declare const normalizeValue: (value: string) => string;
6
+ export declare const normalizeValueWithAsterisk: (initial: string) => string;
package/normalize.js CHANGED
@@ -3,18 +3,25 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.normalizeValue = void 0;
6
+ exports.normalizeValueWithAsterisk = exports.normalizeValue = void 0;
7
7
  /**
8
8
  * Before performing the query, we need to escape all special characters.
9
9
  * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#_reserved_characters
10
10
  */
11
11
 
12
+ const specialCharactersToRemove = [`\\?`];
12
13
  const specialCharacterToSpace = ["-"];
13
14
  const specialCharacters = ["\\\\", "\\+",
14
15
  // "\\-",
15
- "\\=", "\\&\\&", "\\|\\|", ">", "<", "\\!", "\\(", "\\)", "\\{", "\\}", "\\[", "\\]", "\\^", '\\"', "\\~", "\\*", "\\?", "\\:", "\\/", "\\#"];
16
+ "\\=", `\&`, `\\|`, ">", "<", `\!`, "\\(", "\\)", "\\{", "\\}", "\\[", "\\]", "\\^", '\\"', "\\~", "\\*", `\:`, `\/`, "\\#"];
16
17
  const normalizeValue = value => {
17
18
  let result = value || "";
19
+ if (!result) {
20
+ return result;
21
+ }
22
+ for (const character of specialCharactersToRemove) {
23
+ result = result.replace(new RegExp(character, "g"), "");
24
+ }
18
25
  for (const character of specialCharacterToSpace) {
19
26
  result = result.replace(new RegExp(character, "g"), " ");
20
27
  }
@@ -23,4 +30,33 @@ const normalizeValue = value => {
23
30
  }
24
31
  return result || "";
25
32
  };
26
- exports.normalizeValue = normalizeValue;
33
+ exports.normalizeValue = normalizeValue;
34
+ const hasSpecialChar = value => {
35
+ if (!value) {
36
+ return null;
37
+ }
38
+ return value.match(/^([0-9a-zA-Z]+)$/i) === null;
39
+ };
40
+ const normalizeValueWithAsterisk = initial => {
41
+ const value = normalizeValue(initial);
42
+ const results = value.split(" ");
43
+ let result = value;
44
+ /**
45
+ * If there is a / in the first word, do not put asterisk in front of it.
46
+ */
47
+ const firstWord = results[0];
48
+ if (hasSpecialChar(firstWord) === false) {
49
+ result = `*${result}`;
50
+ }
51
+ /**
52
+ * If there is a / in the last word, do not put asterisk at the end of it.
53
+ */
54
+ const lastWord = results[results.length - 1];
55
+ if (hasSpecialChar(lastWord) === false) {
56
+ result = `${result}*`;
57
+ }
58
+ return result;
59
+ };
60
+ exports.normalizeValueWithAsterisk = normalizeValueWithAsterisk;
61
+
62
+ //# sourceMappingURL=normalize.js.map
package/normalize.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["specialCharacterToSpace","specialCharacters","normalizeValue","value","result","character","replace","RegExp"],"sources":["normalize.ts"],"sourcesContent":["/**\n * Before performing the query, we need to escape all special characters.\n * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#_reserved_characters\n */\n\nconst specialCharacterToSpace = [\"-\"];\n\nconst specialCharacters = [\n \"\\\\\\\\\",\n \"\\\\+\",\n // \"\\\\-\",\n \"\\\\=\",\n \"\\\\&\\\\&\",\n \"\\\\|\\\\|\",\n \">\",\n \"<\",\n \"\\\\!\",\n \"\\\\(\",\n \"\\\\)\",\n \"\\\\{\",\n \"\\\\}\",\n \"\\\\[\",\n \"\\\\]\",\n \"\\\\^\",\n '\\\\\"',\n \"\\\\~\",\n \"\\\\*\",\n \"\\\\?\",\n \"\\\\:\",\n \"\\\\/\",\n \"\\\\#\"\n];\n\nexport const normalizeValue = (value: string) => {\n let result = value || \"\";\n for (const character of specialCharacterToSpace) {\n result = result.replace(new RegExp(character, \"g\"), \" \");\n }\n\n for (const character of specialCharacters) {\n result = result.replace(new RegExp(character, \"g\"), `\\\\${character}`);\n }\n\n return result || \"\";\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;;AAEA,MAAMA,uBAAuB,GAAG,CAAC,GAAG,CAAC;AAErC,MAAMC,iBAAiB,GAAG,CACtB,MAAM,EACN,KAAK;AACL;AACA,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,GAAG,EACH,GAAG,EACH,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,CACR;AAEM,MAAMC,cAAc,GAAIC,KAAa,IAAK;EAC7C,IAAIC,MAAM,GAAGD,KAAK,IAAI,EAAE;EACxB,KAAK,MAAME,SAAS,IAAIL,uBAAuB,EAAE;IAC7CI,MAAM,GAAGA,MAAM,CAACE,OAAO,CAAC,IAAIC,MAAM,CAACF,SAAS,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC;EAC5D;EAEA,KAAK,MAAMA,SAAS,IAAIJ,iBAAiB,EAAE;IACvCG,MAAM,GAAGA,MAAM,CAACE,OAAO,CAAC,IAAIC,MAAM,CAACF,SAAS,EAAE,GAAG,CAAC,EAAG,KAAIA,SAAU,EAAC,CAAC;EACzE;EAEA,OAAOD,MAAM,IAAI,EAAE;AACvB,CAAC;AAAC"}
1
+ {"version":3,"names":["specialCharactersToRemove","specialCharacterToSpace","specialCharacters","normalizeValue","value","result","character","replace","RegExp","exports","hasSpecialChar","match","normalizeValueWithAsterisk","initial","results","split","firstWord","lastWord","length"],"sources":["normalize.ts"],"sourcesContent":["/**\n * Before performing the query, we need to escape all special characters.\n * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#_reserved_characters\n */\n\nconst specialCharactersToRemove = [`\\\\?`];\n\nconst specialCharacterToSpace = [\"-\"];\n\nconst specialCharacters = [\n \"\\\\\\\\\",\n \"\\\\+\",\n // \"\\\\-\",\n \"\\\\=\",\n `\\&`,\n `\\\\|`,\n \">\",\n \"<\",\n `\\!`,\n \"\\\\(\",\n \"\\\\)\",\n \"\\\\{\",\n \"\\\\}\",\n \"\\\\[\",\n \"\\\\]\",\n \"\\\\^\",\n '\\\\\"',\n \"\\\\~\",\n \"\\\\*\",\n `\\:`,\n `\\/`,\n \"\\\\#\"\n];\n\nexport const normalizeValue = (value: string) => {\n let result = value || \"\";\n if (!result) {\n return result;\n }\n for (const character of specialCharactersToRemove) {\n result = result.replace(new RegExp(character, \"g\"), \"\");\n }\n for (const character of specialCharacterToSpace) {\n result = result.replace(new RegExp(character, \"g\"), \" \");\n }\n\n for (const character of specialCharacters) {\n result = result.replace(new RegExp(character, \"g\"), `\\\\${character}`);\n }\n\n return result || \"\";\n};\n\nconst hasSpecialChar = (value: string): boolean | null => {\n if (!value) {\n return null;\n }\n return value.match(/^([0-9a-zA-Z]+)$/i) === null;\n};\n\nexport const normalizeValueWithAsterisk = (initial: string) => {\n const value = normalizeValue(initial);\n const results = value.split(\" \");\n\n let result = value;\n /**\n * If there is a / in the first word, do not put asterisk in front of it.\n */\n const firstWord = results[0];\n if (hasSpecialChar(firstWord) === false) {\n result = `*${result}`;\n }\n /**\n * If there is a / in the last word, do not put asterisk at the end of it.\n */\n const lastWord = results[results.length - 1];\n if (hasSpecialChar(lastWord) === false) {\n result = `${result}*`;\n }\n\n return result;\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;;AAEA,MAAMA,yBAAyB,GAAG,CAAE,KAAI,CAAC;AAEzC,MAAMC,uBAAuB,GAAG,CAAC,GAAG,CAAC;AAErC,MAAMC,iBAAiB,GAAG,CACtB,MAAM,EACN,KAAK;AACL;AACA,KAAK,EACJ,IAAG,EACH,KAAI,EACL,GAAG,EACH,GAAG,EACF,IAAG,EACJ,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACJ,IAAG,EACH,IAAG,EACJ,KAAK,CACR;AAEM,MAAMC,cAAc,GAAIC,KAAa,IAAK;EAC7C,IAAIC,MAAM,GAAGD,KAAK,IAAI,EAAE;EACxB,IAAI,CAACC,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IAAIR,cAAc,CAACO,QAAQ,CAAC,KAAK,KAAK,EAAE;IACpCZ,MAAM,GAAI,GAAEA,MAAO,GAAE;EACzB;EAEA,OAAOA,MAAM;AACjB,CAAC;AAACI,OAAA,CAAAG,0BAAA,GAAAA,0BAAA"}
package/operators.js CHANGED
@@ -42,4 +42,6 @@ const getElasticsearchOperatorPluginsByLocale = (plugins, locale) => {
42
42
  return acc;
43
43
  }, {});
44
44
  };
45
- exports.getElasticsearchOperatorPluginsByLocale = getElasticsearchOperatorPluginsByLocale;
45
+ exports.getElasticsearchOperatorPluginsByLocale = getElasticsearchOperatorPluginsByLocale;
46
+
47
+ //# sourceMappingURL=operators.js.map
package/operators.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["operators","ElasticsearchQueryBuilderOperatorBetweenPlugin","ElasticsearchQueryBuilderOperatorNotBetweenPlugin","ElasticsearchQueryBuilderOperatorContainsPlugin","ElasticsearchQueryBuilderOperatorNotContainsPlugin","ElasticsearchQueryBuilderOperatorEqualPlugin","ElasticsearchQueryBuilderOperatorNotPlugin","ElasticsearchQueryBuilderOperatorGreaterThanPlugin","ElasticsearchQueryBuilderOperatorGreaterThanOrEqualToPlugin","ElasticsearchQueryBuilderOperatorLesserThanPlugin","ElasticsearchQueryBuilderOperatorLesserThanOrEqualToPlugin","ElasticsearchQueryBuilderOperatorInPlugin","ElasticsearchQueryBuilderOperatorAndInPlugin","ElasticsearchQueryBuilderOperatorNotInPlugin","ElasticsearchQueryBuilderOperatorStartsWithPlugin","ElasticsearchQueryBuilderOperatorNotStartsWithPlugin","ElasticsearchQueryBuilderJapaneseOperatorContainsPlugin","getElasticsearchOperators","getElasticsearchOperatorPluginsByLocale","plugins","locale","byType","ElasticsearchQueryBuilderOperatorPlugin","type","reduce","acc","plugin","op","getOperator","isLocaleSupported","name","match"],"sources":["operators.ts"],"sourcesContent":["import {\n ElasticsearchQueryBuilderOperatorBetweenPlugin,\n ElasticsearchQueryBuilderJapaneseOperatorContainsPlugin,\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\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { ElasticsearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin\";\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 * Japanese\n */\n new ElasticsearchQueryBuilderJapaneseOperatorContainsPlugin()\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\nexport const getElasticsearchOperatorPluginsByLocale = (\n plugins: PluginsContainer,\n locale: string\n): Record<string, ElasticsearchQueryBuilderOperatorPlugin> => {\n /**\n * We always set the last one operator plugin added.\n * This way user can override the plugins.\n */\n return plugins\n .byType<ElasticsearchQueryBuilderOperatorPlugin>(\n ElasticsearchQueryBuilderOperatorPlugin.type\n )\n .reduce((acc, plugin) => {\n const op = plugin.getOperator();\n /**\n * We only allow the plugins which can pass the locale test.\n * The default plugins always return true.\n */\n if (plugin.isLocaleSupported(locale) === false) {\n return acc;\n }\n /**\n * We also only allow the override of the plugins if the new plugin is NOT a default one.\n * If a user names the plugin with .default, we cannot do anything about it.\n */\n if (!!acc[op] && (plugin.name || \"\").match(/\\.default$/)) {\n return acc;\n }\n acc[op] = plugin;\n return acc;\n }, {} as Record<string, ElasticsearchQueryBuilderOperatorPlugin>);\n};\n"],"mappings":";;;;;;AAAA;AAmBA;AAEA,MAAMA,SAAS,GAAG,CACd,IAAIC,wDAA8C,EAAE,EACpD,IAAIC,2DAAiD,EAAE,EACvD,IAAIC,yDAA+C,EAAE,EACrD,IAAIC,4DAAkD,EAAE,EACxD,IAAIC,sDAA4C,EAAE,EAClD,IAAIC,oDAA0C,EAAE,EAChD,IAAIC,4DAAkD,EAAE,EACxD,IAAIC,qEAA2D,EAAE,EACjE,IAAIC,2DAAiD,EAAE,EACvD,IAAIC,oEAA0D,EAAE,EAChE,IAAIC,mDAAyC,EAAE,EAC/C,IAAIC,sDAA4C,EAAE,EAClD,IAAIC,sDAA4C,EAAE,EAClD,IAAIC,2DAAiD,EAAE,EACvD,IAAIC,8DAAoD,EAAE;AAC1D;AACJ;AACA;AACI,IAAIC,iEAAuD,EAAE,CAChE;AACD;AACA;AACA;AACA;AACO,MAAMC,yBAAyB,GAAG,MAAMjB,SAAS;AAAC;AAElD,MAAMkB,uCAAuC,GAAG,CACnDC,OAAyB,EACzBC,MAAc,KAC4C;EAC1D;AACJ;AACA;AACA;EACI,OAAOD,OAAO,CACTE,MAAM,CACHC,gFAAuC,CAACC,IAAI,CAC/C,CACAC,MAAM,CAAC,CAACC,GAAG,EAAEC,MAAM,KAAK;IACrB,MAAMC,EAAE,GAAGD,MAAM,CAACE,WAAW,EAAE;IAC/B;AACZ;AACA;AACA;IACY,IAAIF,MAAM,CAACG,iBAAiB,CAACT,MAAM,CAAC,KAAK,KAAK,EAAE;MAC5C,OAAOK,GAAG;IACd;IACA;AACZ;AACA;AACA;IACY,IAAI,CAAC,CAACA,GAAG,CAACE,EAAE,CAAC,IAAI,CAACD,MAAM,CAACI,IAAI,IAAI,EAAE,EAAEC,KAAK,CAAC,YAAY,CAAC,EAAE;MACtD,OAAON,GAAG;IACd;IACAA,GAAG,CAACE,EAAE,CAAC,GAAGD,MAAM;IAChB,OAAOD,GAAG;EACd,CAAC,EAAE,CAAC,CAAC,CAA4D;AACzE,CAAC;AAAC"}
1
+ {"version":3,"names":["_operator","require","_ElasticsearchQueryBuilderOperatorPlugin","operators","ElasticsearchQueryBuilderOperatorBetweenPlugin","ElasticsearchQueryBuilderOperatorNotBetweenPlugin","ElasticsearchQueryBuilderOperatorContainsPlugin","ElasticsearchQueryBuilderOperatorNotContainsPlugin","ElasticsearchQueryBuilderOperatorEqualPlugin","ElasticsearchQueryBuilderOperatorNotPlugin","ElasticsearchQueryBuilderOperatorGreaterThanPlugin","ElasticsearchQueryBuilderOperatorGreaterThanOrEqualToPlugin","ElasticsearchQueryBuilderOperatorLesserThanPlugin","ElasticsearchQueryBuilderOperatorLesserThanOrEqualToPlugin","ElasticsearchQueryBuilderOperatorInPlugin","ElasticsearchQueryBuilderOperatorAndInPlugin","ElasticsearchQueryBuilderOperatorNotInPlugin","ElasticsearchQueryBuilderOperatorStartsWithPlugin","ElasticsearchQueryBuilderOperatorNotStartsWithPlugin","ElasticsearchQueryBuilderJapaneseOperatorContainsPlugin","getElasticsearchOperators","exports","getElasticsearchOperatorPluginsByLocale","plugins","locale","byType","ElasticsearchQueryBuilderOperatorPlugin","type","reduce","acc","plugin","op","getOperator","isLocaleSupported","name","match"],"sources":["operators.ts"],"sourcesContent":["import {\n ElasticsearchQueryBuilderOperatorBetweenPlugin,\n ElasticsearchQueryBuilderJapaneseOperatorContainsPlugin,\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\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { ElasticsearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin\";\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 * Japanese\n */\n new ElasticsearchQueryBuilderJapaneseOperatorContainsPlugin()\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\nexport const getElasticsearchOperatorPluginsByLocale = (\n plugins: PluginsContainer,\n locale: string\n): Record<string, ElasticsearchQueryBuilderOperatorPlugin> => {\n /**\n * We always set the last one operator plugin added.\n * This way user can override the plugins.\n */\n return plugins\n .byType<ElasticsearchQueryBuilderOperatorPlugin>(\n ElasticsearchQueryBuilderOperatorPlugin.type\n )\n .reduce((acc, plugin) => {\n const op = plugin.getOperator();\n /**\n * We only allow the plugins which can pass the locale test.\n * The default plugins always return true.\n */\n if (plugin.isLocaleSupported(locale) === false) {\n return acc;\n }\n /**\n * We also only allow the override of the plugins if the new plugin is NOT a default one.\n * If a user names the plugin with .default, we cannot do anything about it.\n */\n if (!!acc[op] && (plugin.name || \"\").match(/\\.default$/)) {\n return acc;\n }\n acc[op] = plugin;\n return acc;\n }, {} as Record<string, ElasticsearchQueryBuilderOperatorPlugin>);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAmBA,IAAAC,wCAAA,GAAAD,OAAA;AAEA,MAAME,SAAS,GAAG,CACd,IAAIC,wDAA8C,CAAC,CAAC,EACpD,IAAIC,2DAAiD,CAAC,CAAC,EACvD,IAAIC,yDAA+C,CAAC,CAAC,EACrD,IAAIC,4DAAkD,CAAC,CAAC,EACxD,IAAIC,sDAA4C,CAAC,CAA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