@webiny/api-elasticsearch 0.0.0-unstable.99666aeb00 → 0.0.0-unstable.9bd236cf5e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client.d.ts +1 -0
- package/client.js +79 -32
- package/client.js.map +1 -1
- package/compression.d.ts +1 -1
- package/compression.js +14 -33
- package/compression.js.map +1 -1
- package/cursors.d.ts +2 -2
- package/cursors.js +7 -5
- package/cursors.js.map +1 -1
- package/index.d.ts +6 -3
- package/index.js +52 -11
- package/index.js.map +1 -1
- package/indexConfiguration/base.d.ts +1 -1
- package/indexConfiguration/base.js +3 -1
- package/indexConfiguration/base.js.map +1 -1
- package/indexConfiguration/common.d.ts +1 -1
- package/indexConfiguration/common.js +14 -1
- package/indexConfiguration/common.js.map +1 -1
- package/indexConfiguration/index.js +3 -1
- package/indexConfiguration/index.js.map +1 -1
- package/indexConfiguration/japanese.d.ts +1 -1
- package/indexConfiguration/japanese.js +3 -1
- package/indexConfiguration/japanese.js.map +1 -1
- package/indexPrefix.d.ts +1 -0
- package/indexPrefix.js +12 -0
- package/indexPrefix.js.map +1 -0
- package/indices.d.ts +2 -2
- package/indices.js +3 -1
- package/indices.js.map +1 -1
- package/limit.js +3 -1
- package/limit.js.map +1 -1
- package/normalize.d.ts +1 -0
- package/normalize.js +39 -3
- package/normalize.js.map +1 -1
- package/operations/ElasticsearchCatHealth.d.ts +7 -0
- package/operations/ElasticsearchCatHealth.js +38 -0
- package/operations/ElasticsearchCatHealth.js.map +1 -0
- package/operations/ElasticsearchCatNodes.d.ts +7 -0
- package/operations/ElasticsearchCatNodes.js +36 -0
- package/operations/ElasticsearchCatNodes.js.map +1 -0
- package/operations/index.d.ts +3 -0
- package/operations/index.js +40 -0
- package/operations/index.js.map +1 -0
- package/operations/stripConnectionFromException.d.ts +1 -0
- package/operations/stripConnectionFromException.js +24 -0
- package/operations/stripConnectionFromException.js.map +1 -0
- package/operations/types.d.ts +35 -0
- package/operations/types.js +14 -0
- package/operations/types.js.map +1 -0
- package/operators.d.ts +1 -1
- package/operators.js +3 -1
- package/operators.js.map +1 -1
- package/package.json +11 -24
- package/plugins/definition/ElasticsearchBodyModifierPlugin.d.ts +1 -1
- package/plugins/definition/ElasticsearchBodyModifierPlugin.js +3 -3
- package/plugins/definition/ElasticsearchBodyModifierPlugin.js.map +1 -1
- package/plugins/definition/ElasticsearchFieldPlugin.d.ts +2 -2
- package/plugins/definition/ElasticsearchFieldPlugin.js +7 -13
- package/plugins/definition/ElasticsearchFieldPlugin.js.map +1 -1
- package/plugins/definition/ElasticsearchIndexPlugin.d.ts +1 -1
- package/plugins/definition/ElasticsearchIndexPlugin.js +6 -6
- package/plugins/definition/ElasticsearchIndexPlugin.js.map +1 -1
- package/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.d.ts +1 -1
- package/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.js +4 -3
- package/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin.js.map +1 -1
- package/plugins/definition/ElasticsearchQueryModifierPlugin.d.ts +1 -1
- package/plugins/definition/ElasticsearchQueryModifierPlugin.js +3 -3
- package/plugins/definition/ElasticsearchQueryModifierPlugin.js.map +1 -1
- package/plugins/definition/ElasticsearchSortModifierPlugin.d.ts +1 -1
- package/plugins/definition/ElasticsearchSortModifierPlugin.js +3 -3
- package/plugins/definition/ElasticsearchSortModifierPlugin.js.map +1 -1
- package/plugins/definition/index.d.ts +0 -1
- package/plugins/definition/index.js +3 -12
- package/plugins/definition/index.js.map +1 -1
- package/plugins/index.js +3 -1
- package/plugins/index.js.map +1 -1
- package/plugins/operator/andIn.d.ts +1 -1
- package/plugins/operator/andIn.js +4 -7
- package/plugins/operator/andIn.js.map +1 -1
- package/plugins/operator/between.d.ts +1 -1
- package/plugins/operator/between.js +4 -7
- package/plugins/operator/between.js.map +1 -1
- package/plugins/operator/contains.d.ts +1 -1
- package/plugins/operator/contains.js +5 -8
- package/plugins/operator/contains.js.map +1 -1
- package/plugins/operator/equal.d.ts +1 -1
- package/plugins/operator/equal.js +5 -8
- package/plugins/operator/equal.js.map +1 -1
- package/plugins/operator/gt.d.ts +1 -1
- package/plugins/operator/gt.js +4 -7
- package/plugins/operator/gt.js.map +1 -1
- package/plugins/operator/gte.d.ts +1 -1
- package/plugins/operator/gte.js +4 -7
- package/plugins/operator/gte.js.map +1 -1
- package/plugins/operator/in.d.ts +1 -1
- package/plugins/operator/in.js +4 -7
- package/plugins/operator/in.js.map +1 -1
- package/plugins/operator/index.js +3 -1
- package/plugins/operator/index.js.map +1 -1
- package/plugins/operator/japanese/contains.d.ts +1 -1
- package/plugins/operator/japanese/contains.js +7 -10
- package/plugins/operator/japanese/contains.js.map +1 -1
- package/plugins/operator/lt.d.ts +1 -1
- package/plugins/operator/lt.js +4 -7
- package/plugins/operator/lt.js.map +1 -1
- package/plugins/operator/lte.d.ts +1 -1
- package/plugins/operator/lte.js +4 -7
- package/plugins/operator/lte.js.map +1 -1
- package/plugins/operator/not.d.ts +1 -1
- package/plugins/operator/not.js +11 -10
- package/plugins/operator/not.js.map +1 -1
- package/plugins/operator/notBetween.d.ts +1 -1
- package/plugins/operator/notBetween.js +4 -7
- package/plugins/operator/notBetween.js.map +1 -1
- package/plugins/operator/notContains.d.ts +1 -1
- package/plugins/operator/notContains.js +5 -8
- package/plugins/operator/notContains.js.map +1 -1
- package/plugins/operator/notIn.d.ts +1 -1
- package/plugins/operator/notIn.js +4 -7
- package/plugins/operator/notIn.js.map +1 -1
- package/plugins/operator/notStartsWith.d.ts +1 -1
- package/plugins/operator/notStartsWith.js +7 -7
- package/plugins/operator/notStartsWith.js.map +1 -1
- package/plugins/operator/startsWith.d.ts +1 -1
- package/plugins/operator/startsWith.js +7 -7
- package/plugins/operator/startsWith.js.map +1 -1
- package/sharedIndex.d.ts +1 -0
- package/sharedIndex.js +12 -0
- package/sharedIndex.js.map +1 -0
- package/sort.d.ts +1 -1
- package/sort.js +13 -2
- package/sort.js.map +1 -1
- package/types.d.ts +31 -19
- package/types.js +3 -1
- package/types.js.map +1 -1
- package/utils/createIndex.d.ts +20 -0
- package/utils/createIndex.js +100 -0
- package/utils/createIndex.js.map +1 -0
- package/utils/index.d.ts +3 -0
- package/utils/index.js +29 -0
- package/utils/index.js.map +1 -0
- package/utils/waitUntilHealthy/UnhealthyClusterError.d.ts +4 -0
- package/utils/waitUntilHealthy/UnhealthyClusterError.js +18 -0
- package/utils/waitUntilHealthy/UnhealthyClusterError.js.map +1 -0
- package/utils/waitUntilHealthy/WaitUntilHealthy.d.ts +71 -0
- package/utils/waitUntilHealthy/WaitUntilHealthy.js +157 -0
- package/utils/waitUntilHealthy/WaitUntilHealthy.js.map +1 -0
- package/utils/waitUntilHealthy/WaitingHealthyClusterAbortedError.d.ts +4 -0
- package/utils/waitUntilHealthy/WaitingHealthyClusterAbortedError.js +18 -0
- package/utils/waitUntilHealthy/WaitingHealthyClusterAbortedError.js.map +1 -0
- package/utils/waitUntilHealthy/index.d.ts +6 -0
- package/utils/waitUntilHealthy/index.js +51 -0
- package/utils/waitUntilHealthy/index.js.map +1 -0
- package/utils/waitUntilHealthy/reason/ClusterHealthReason.d.ts +15 -0
- package/utils/waitUntilHealthy/reason/ClusterHealthReason.js +21 -0
- package/utils/waitUntilHealthy/reason/ClusterHealthReason.js.map +1 -0
- package/utils/waitUntilHealthy/reason/IReason.d.ts +4 -0
- package/utils/waitUntilHealthy/reason/IReason.js +7 -0
- package/utils/waitUntilHealthy/reason/IReason.js.map +1 -0
- package/utils/waitUntilHealthy/reason/MemoryReason.d.ts +14 -0
- package/utils/waitUntilHealthy/reason/MemoryReason.js +21 -0
- package/utils/waitUntilHealthy/reason/MemoryReason.js.map +1 -0
- package/utils/waitUntilHealthy/reason/ProcessorReason.d.ts +14 -0
- package/utils/waitUntilHealthy/reason/ProcessorReason.js +21 -0
- package/utils/waitUntilHealthy/reason/ProcessorReason.js.map +1 -0
- package/utils/waitUntilHealthy/reason/index.d.ts +3 -0
- package/utils/waitUntilHealthy/reason/index.js +40 -0
- package/utils/waitUntilHealthy/reason/index.js.map +1 -0
- package/where.d.ts +3 -3
- package/where.js +3 -1
- package/where.js.map +1 -1
- package/plugins/GzipCompression.d.ts +0 -24
- package/plugins/GzipCompression.js +0 -68
- package/plugins/GzipCompression.js.map +0 -1
- package/plugins/definition/CompressionPlugin.d.ts +0 -20
- package/plugins/definition/CompressionPlugin.js +0 -12
- package/plugins/definition/CompressionPlugin.js.map +0 -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,87 @@ 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
|
-
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
+
credentials
|
|
66
|
+
})
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
try {
|
|
70
|
+
return new _elasticsearch.Client(clientOptions);
|
|
71
|
+
} catch (ex) {
|
|
72
|
+
const data = {
|
|
73
|
+
error: ex,
|
|
74
|
+
node: endpoint || node,
|
|
75
|
+
...rest,
|
|
76
|
+
auth: undefined
|
|
77
|
+
};
|
|
78
|
+
console.error({
|
|
79
|
+
...data
|
|
80
|
+
});
|
|
81
|
+
throw new _error.default("Could not connect to Elasticsearch.", "ELASTICSEARCH_CLIENT_ERROR", data);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const client = cached();
|
|
85
|
+
clients.set(key, client);
|
|
86
|
+
return client;
|
|
42
87
|
};
|
|
43
|
-
exports.createElasticsearchClient = createElasticsearchClient;
|
|
88
|
+
exports.createElasticsearchClient = createElasticsearchClient;
|
|
89
|
+
|
|
90
|
+
//# sourceMappingURL=client.js.map
|
package/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
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","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 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.error({\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,IAAAG,cAAA,GAAAH,OAAA;AAMA,MAAMI,OAAO,GAAG,IAAIC,GAAG,CAAiB,CAAC;AAEzC,MAAMC,eAAe,GAAIC,OAAmC,IAAK;EAC7D,MAAMC,GAAG,GAAGC,IAAI,CAACC,SAAS,CAACH,OAAO,CAAC;EACnC,MAAMI,IAAI,GAAGC,eAAM,CAACC,UAAU,CAAC,MAAM,CAAC;EACtCF,IAAI,CAACG,MAAM,CAACN,GAAG,CAAC;EAChB,OAAOG,IAAI,CAACI,MAAM,CAAC,KAAK,CAAC;AAC7B,CAAC;AAIM,MAAMC,yBAAyB,GAAIT,OAAmC,IAAa;EACtF,MAAMC,GAAG,GAAGF,eAAe,CAACC,OAAO,CAAC;EACpC,MAAMU,QAAQ,GAAGb,OAAO,CAACc,GAAG,CAACV,GAAG,CAAC;EACjC,IAAIS,QAAQ,EAAE;IACV,OAAOA,QAAQ;EACnB;EAEA,MAAME,MAAM,GAAGA,CAAA,KAAc;IACzB,MAAM;MAAEC,QAAQ;MAAEC,IAAI;MAAE,GAA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qC,EACrC,4BAA4B,EAC5BK,IACJ,CAAC;IACL;EACJ,CAAC;EAED,MAAMI,MAAM,GAAGjC,MAAM,CAAC,CAAC;EAEvBf,OAAO,CAACiD,GAAG,CAAC7C,GAAG,EAAE4C,MAAM,CAAC;EACxB,OAAOA,MAAM;AACjB,CAAC;AAACE,OAAA,CAAAtC,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
package/compression.d.ts
CHANGED
package/compression.js
CHANGED
|
@@ -4,48 +4,29 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.decompress = exports.compress = void 0;
|
|
7
|
-
var
|
|
8
|
-
/**
|
|
9
|
-
* Get the compression plugins, in reverse order, because we want to use the last one added - first.
|
|
10
|
-
*/
|
|
11
|
-
const getCompressionPlugins = plugins => {
|
|
12
|
-
return plugins.byType(_CompressionPlugin.CompressionPlugin.type).reverse();
|
|
13
|
-
};
|
|
7
|
+
var _api = require("@webiny/api");
|
|
14
8
|
/**
|
|
15
9
|
* Method to compress the elasticsearch data that is going to be stored into the DynamoDB table that is meant for elasticsearch.
|
|
16
10
|
*/
|
|
17
11
|
const compress = async (pluginsContainer, data) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
let plugin;
|
|
13
|
+
try {
|
|
14
|
+
plugin = pluginsContainer.oneByType(_api.CompressorPlugin.type);
|
|
15
|
+
} catch (ex) {
|
|
21
16
|
return data;
|
|
22
17
|
}
|
|
23
|
-
|
|
24
|
-
if (plugin.canCompress(data) === false) {
|
|
25
|
-
continue;
|
|
26
|
-
}
|
|
27
|
-
return await plugin.compress(data);
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Possibly no plugins that can compress, just return the data.
|
|
31
|
-
*/
|
|
32
|
-
return data;
|
|
18
|
+
return plugin.getCompressor().compress(data);
|
|
33
19
|
};
|
|
34
20
|
exports.compress = compress;
|
|
35
21
|
const decompress = async (pluginsContainer, data) => {
|
|
36
|
-
|
|
37
|
-
|
|
22
|
+
let plugin;
|
|
23
|
+
try {
|
|
24
|
+
plugin = pluginsContainer.oneByType(_api.CompressorPlugin.type);
|
|
25
|
+
} catch (ex) {
|
|
38
26
|
return data;
|
|
39
27
|
}
|
|
40
|
-
|
|
41
|
-
if (plugin.canDecompress(data) === false) {
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
return await plugin.decompress(data);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Possibly no plugins that can decompress, just return the data.
|
|
48
|
-
*/
|
|
49
|
-
return data;
|
|
28
|
+
return plugin.getCompressor().decompress(data);
|
|
50
29
|
};
|
|
51
|
-
exports.decompress = decompress;
|
|
30
|
+
exports.decompress = decompress;
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=compression.js.map
|
package/compression.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_api","require","compress","pluginsContainer","data","plugin","oneByType","CompressorPlugin","type","ex","getCompressor","exports","decompress"],"sources":["compression.ts"],"sourcesContent":["import type { PluginsContainer } from \"@webiny/plugins\";\nimport { CompressorPlugin } from \"@webiny/api\";\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 let plugin: CompressorPlugin;\n try {\n plugin = pluginsContainer.oneByType<CompressorPlugin>(CompressorPlugin.type);\n } catch (ex) {\n return data;\n }\n return plugin.getCompressor().compress(data);\n};\n\nexport const decompress = async (\n pluginsContainer: PluginsContainer,\n data: Record<string, any>\n): Promise<Record<string, any>> => {\n let plugin: CompressorPlugin;\n try {\n plugin = pluginsContainer.oneByType<CompressorPlugin>(CompressorPlugin.type);\n } catch (ex) {\n return data;\n }\n return plugin.getCompressor().decompress(data);\n};\n"],"mappings":";;;;;;AACA,IAAAA,IAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACO,MAAMC,QAAQ,GAAG,MAAAA,CACpBC,gBAAkC,EAClCC,IAAyB,KACM;EAC/B,IAAIC,MAAwB;EAC5B,IAAI;IACAA,MAAM,GAAGF,gBAAgB,CAACG,SAAS,CAAmBC,qBAAgB,CAACC,IAAI,CAAC;EAChF,CAAC,CAAC,OAAOC,EAAE,EAAE;IACT,OAAOL,IAAI;EACf;EACA,OAAOC,MAAM,CAACK,aAAa,CAAC,CAAC,CAACR,QAAQ,CAACE,IAAI,CAAC;AAChD,CAAC;AAACO,OAAA,CAAAT,QAAA,GAAAA,QAAA;AAEK,MAAMU,UAAU,GAAG,MAAAA,CACtBT,gBAAkC,EAClCC,IAAyB,KACM;EAC/B,IAAIC,MAAwB;EAC5B,IAAI;IACAA,MAAM,GAAGF,gBAAgB,CAACG,SAAS,CAAmBC,qBAAgB,CAACC,IAAI,CAAC;EAChF,CAAC,CAAC,OAAOC,EAAE,EAAE;IACT,OAAOL,IAAI;EACf;EACA,OAAOC,MAAM,CAACK,aAAa,CAAC,CAAC,CAACE,UAAU,CAACR,IAAI,CAAC;AAClD,CAAC;AAACO,OAAA,CAAAC,UAAA,GAAAA,UAAA","ignoreList":[]}
|
package/cursors.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { PrimitiveValue } from "./types";
|
|
1
|
+
import type { PrimitiveValue } from "./types";
|
|
2
2
|
/**
|
|
3
3
|
* Encode a received cursor value into something that can be passed on to the user.
|
|
4
4
|
*/
|
|
5
|
-
export declare const encodeCursor: (
|
|
5
|
+
export declare const encodeCursor: (input?: PrimitiveValue[]) => string | undefined;
|
|
6
6
|
/**
|
|
7
7
|
* Decode a received value into a Elasticsearch cursor.
|
|
8
8
|
* If no value is received or is not decodable, return undefined.
|
package/cursors.js
CHANGED
|
@@ -7,11 +7,11 @@ exports.encodeCursor = exports.decodeCursor = void 0;
|
|
|
7
7
|
/**
|
|
8
8
|
* Encode a received cursor value into something that can be passed on to the user.
|
|
9
9
|
*/
|
|
10
|
-
const encodeCursor =
|
|
11
|
-
if (!
|
|
10
|
+
const encodeCursor = input => {
|
|
11
|
+
if (!input) {
|
|
12
12
|
return undefined;
|
|
13
13
|
}
|
|
14
|
-
cursor = Array.isArray(
|
|
14
|
+
const cursor = Array.isArray(input) ? input.filter(item => item !== null).map(item => encodeURIComponent(item)) : encodeURIComponent(input);
|
|
15
15
|
try {
|
|
16
16
|
return Buffer.from(JSON.stringify(cursor)).toString("base64");
|
|
17
17
|
} catch (ex) {
|
|
@@ -31,7 +31,7 @@ const decodeCursor = cursor => {
|
|
|
31
31
|
try {
|
|
32
32
|
const value = JSON.parse(Buffer.from(cursor, "base64").toString("ascii"));
|
|
33
33
|
if (Array.isArray(value)) {
|
|
34
|
-
return value.map(decodeURIComponent);
|
|
34
|
+
return value.filter(item => item !== null).map(decodeURIComponent);
|
|
35
35
|
}
|
|
36
36
|
const decoded = decodeURIComponent(value);
|
|
37
37
|
return decoded ? [decoded] : undefined;
|
|
@@ -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","
|
|
1
|
+
{"version":3,"names":["encodeCursor","input","undefined","cursor","Array","isArray","filter","item","map","encodeURIComponent","Buffer","from","JSON","stringify","toString","ex","console","error","message","exports","decodeCursor","value","parse","decodeURIComponent","decoded"],"sources":["cursors.ts"],"sourcesContent":["import type { 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 = (input?: PrimitiveValue[]): string | undefined => {\n if (!input) {\n return undefined;\n }\n\n const cursor = Array.isArray(input)\n ? input\n .filter((item: PrimitiveValue): item is string | number | boolean => item !== null)\n .map(item => encodeURIComponent(item))\n : encodeURIComponent(input);\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.filter(item => item !== null).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,KAAwB,IAAyB;EAC1E,IAAI,CAACA,KAAK,EAAE;IACR,OAAOC,SAAS;EACpB;EAEA,MAAMC,MAAM,GAAGC,KAAK,CAACC,OAAO,CAACJ,KAAK,CAAC,GAC7BA,KAAK,CACAK,MAAM,CAAEC,IAAoB,IAAwCA,IAAI,KAAK,IAAI,CAAC,CAClFC,GAAG,CAACD,IAAI,IAAIE,kBAAkB,CAACF,IAAI,CAAC,CAAC,GAC1CE,kBAAkB,CAACR,KAAK,CAAC;EAE/B,IAAI;IACA,OAAOS,MAAM,CAACC,IAAI,CAACC,IAAI,CAACC,SAAS,CAACV,MAAM,CAAC,CAAC,CAACW,QAAQ,CAAC,QAAQ,CAAC;EACjE,CAAC,CAAC,OAAOC,EAAE,EAAE;IACTC,OAAO,CAACC,KAAK,CAACF,EAAE,CAACG,OAAO,CAAC;EAC7B;EACA,OAAOhB,SAAS;AACpB,CAAC;AACD;AACA;AACA;AACA;AAHAiB,OAAA,CAAAnB,YAAA,GAAAA,YAAA;AAIO,MAAMoB,YAAY,GAAIjB,MAAsB,IAAmC;EAClF,IAAI,CAACA,MAAM,EAAE;IACT,OAAOD,SAAS;EACpB;EACA,IAAI;IACA,MAAMmB,KAAK,GAAGT,IAAI,CAACU,KAAK,CAACZ,MAAM,CAACC,IAAI,CAACR,MAAM,EAAE,QAAQ,CAAC,CAACW,QAAQ,CAAC,OAAO,CAAC,CAAC;IACzE,IAAIV,KAAK,CAACC,OAAO,CAACgB,KAAK,CAAC,EAAE;MACtB,OAAOA,KAAK,CAACf,MAAM,CAACC,IAAI,IAAIA,IAAI,KAAK,IAAI,CAAC,CAACC,GAAG,CAACe,kBAAkB,CAAC;IACtE;IACA,MAAMC,OAAO,GAAGD,kBAAkB,CAACF,KAAK,CAAC;IACzC,OAAOG,OAAO,GAAG,CAACA,OAAO,CAAC,GAAGtB,SAAS;EAC1C,CAAC,CAAC,OAAOa,EAAE,EAAE;IACTC,OAAO,CAACC,KAAK,CAACF,EAAE,CAACG,OAAO,CAAC;EAC7B;EACA,OAAOhB,SAAS;AACpB,CAAC;AAACiB,OAAA,CAAAC,YAAA,GAAAA,YAAA","ignoreList":[]}
|
package/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ElasticsearchContext } from "./types";
|
|
1
|
+
import type { ElasticsearchContext } from "./types";
|
|
2
2
|
import { ContextPlugin } from "@webiny/api";
|
|
3
|
-
import { ElasticsearchClientOptions } from "./client";
|
|
3
|
+
import type { ElasticsearchClientOptions } from "./client";
|
|
4
4
|
import { Client } from "@elastic/elasticsearch";
|
|
5
5
|
export * from "./indexConfiguration";
|
|
6
6
|
export * from "./plugins";
|
|
@@ -13,7 +13,10 @@ export * from "./compression";
|
|
|
13
13
|
export * from "./operators";
|
|
14
14
|
export * from "./cursors";
|
|
15
15
|
export * from "./client";
|
|
16
|
-
export
|
|
16
|
+
export * from "./utils";
|
|
17
|
+
export * from "./operations";
|
|
18
|
+
export * from "./sharedIndex";
|
|
19
|
+
export * from "./indexPrefix";
|
|
17
20
|
/**
|
|
18
21
|
* We must accept either Elasticsearch client or options that create the client.
|
|
19
22
|
*/
|
package/index.js
CHANGED
|
@@ -4,15 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
var _exportNames = {
|
|
8
|
-
createGzipCompression: true
|
|
9
|
-
};
|
|
10
|
-
Object.defineProperty(exports, "createGzipCompression", {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _GzipCompression.createGzipCompression;
|
|
14
|
-
}
|
|
15
|
-
});
|
|
7
|
+
var _exportNames = {};
|
|
16
8
|
exports.default = void 0;
|
|
17
9
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
18
10
|
var _api = require("@webiny/api");
|
|
@@ -149,7 +141,54 @@ Object.keys(_cursors).forEach(function (key) {
|
|
|
149
141
|
}
|
|
150
142
|
});
|
|
151
143
|
});
|
|
152
|
-
var
|
|
144
|
+
var _utils = require("./utils");
|
|
145
|
+
Object.keys(_utils).forEach(function (key) {
|
|
146
|
+
if (key === "default" || key === "__esModule") return;
|
|
147
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
148
|
+
if (key in exports && exports[key] === _utils[key]) return;
|
|
149
|
+
Object.defineProperty(exports, key, {
|
|
150
|
+
enumerable: true,
|
|
151
|
+
get: function () {
|
|
152
|
+
return _utils[key];
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
var _operations = require("./operations");
|
|
157
|
+
Object.keys(_operations).forEach(function (key) {
|
|
158
|
+
if (key === "default" || key === "__esModule") return;
|
|
159
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
160
|
+
if (key in exports && exports[key] === _operations[key]) return;
|
|
161
|
+
Object.defineProperty(exports, key, {
|
|
162
|
+
enumerable: true,
|
|
163
|
+
get: function () {
|
|
164
|
+
return _operations[key];
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
var _sharedIndex = require("./sharedIndex");
|
|
169
|
+
Object.keys(_sharedIndex).forEach(function (key) {
|
|
170
|
+
if (key === "default" || key === "__esModule") return;
|
|
171
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
172
|
+
if (key in exports && exports[key] === _sharedIndex[key]) return;
|
|
173
|
+
Object.defineProperty(exports, key, {
|
|
174
|
+
enumerable: true,
|
|
175
|
+
get: function () {
|
|
176
|
+
return _sharedIndex[key];
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
var _indexPrefix = require("./indexPrefix");
|
|
181
|
+
Object.keys(_indexPrefix).forEach(function (key) {
|
|
182
|
+
if (key === "default" || key === "__esModule") return;
|
|
183
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
184
|
+
if (key in exports && exports[key] === _indexPrefix[key]) return;
|
|
185
|
+
Object.defineProperty(exports, key, {
|
|
186
|
+
enumerable: true,
|
|
187
|
+
get: function () {
|
|
188
|
+
return _indexPrefix[key];
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
});
|
|
153
192
|
/**
|
|
154
193
|
* TODO File should contain only exports from other files.
|
|
155
194
|
*/
|
|
@@ -168,4 +207,6 @@ var _default = params => {
|
|
|
168
207
|
context.plugins.register((0, _operators.getElasticsearchOperators)());
|
|
169
208
|
});
|
|
170
209
|
};
|
|
171
|
-
exports.default = _default;
|
|
210
|
+
exports.default = _default;
|
|
211
|
+
|
|
212
|
+
//# 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 {
|
|
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","_operations","_sharedIndex","_indexPrefix","_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 type { ElasticsearchContext } from \"~/types\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport type { ElasticsearchClientOptions } from \"~/client\";\nimport { createElasticsearchClient } 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 * from \"./operations\";\nexport * from \"./sharedIndex\";\nexport * from \"./indexPrefix\";\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,I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amic_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,
|
|
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 type { 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","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ElasticsearchIndexRequestBodyMappingsDynamicTemplate } from "../types";
|
|
1
|
+
import type { ElasticsearchIndexRequestBodyMappingsDynamicTemplate } from "../types";
|
|
2
2
|
interface Modifier {
|
|
3
3
|
(mappings: ElasticsearchIndexRequestBodyMappingsDynamicTemplate[]): ElasticsearchIndexRequestBodyMappingsDynamicTemplate[];
|
|
4
4
|
}
|
|
@@ -6,6 +6,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getCommonMappings = void 0;
|
|
7
7
|
const getDefaultMappings = () => {
|
|
8
8
|
return [{
|
|
9
|
+
ids: {
|
|
10
|
+
match: "^id|entryId$",
|
|
11
|
+
mapping: {
|
|
12
|
+
type: "string",
|
|
13
|
+
keyword: true
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}, {
|
|
17
|
+
/**
|
|
18
|
+
* Update with the correct date fields.
|
|
19
|
+
*/
|
|
9
20
|
dates: {
|
|
10
21
|
match: "^createdOn|savedOn|publishedOn$",
|
|
11
22
|
mapping: {
|
|
@@ -38,4 +49,6 @@ const getCommonMappings = cb => {
|
|
|
38
49
|
}
|
|
39
50
|
return cb(getDefaultMappings());
|
|
40
51
|
};
|
|
41
|
-
exports.getCommonMappings = getCommonMappings;
|
|
52
|
+
exports.getCommonMappings = getCommonMappings;
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getDefaultMappings","
|
|
1
|
+
{"version":3,"names":["getDefaultMappings","ids","match","mapping","type","keyword","dates","numbers","scaling_factor","booleans","getCommonMappings","cb","exports"],"sources":["common.ts"],"sourcesContent":["import type { ElasticsearchIndexRequestBodyMappingsDynamicTemplate } from \"~/types\";\n\nconst getDefaultMappings = (): ElasticsearchIndexRequestBodyMappingsDynamicTemplate[] => {\n return [\n {\n ids: {\n match: \"^id|entryId$\",\n mapping: {\n type: \"string\",\n keyword: true\n }\n }\n },\n {\n /**\n * Update with the correct date fields.\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,GAAG,EAAE;MACDC,KAAK,EAAE,cAAc;MACrBC,OAAO,EAAE;QACLC,IAAI,EAAE,QAAQ;QACdC,OAAO,EAAE;MACb;IACJ;EACJ,CAAC,EACD;IACI;AACZ;AACA;IACYC,KAAK,EAAE;MACHJ,KAAK,EAAE,iCAAiC;MACxCC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV;IACJ;EACJ,CAAC,EACD;IACIG,OAAO,EAAE;MACLL,KAAK,EAAE,UAAU;MACjBC,OAAO,EAAE;QACLC,IAAI,EAAE,cAAc;QACpBI,cAAc,EAAE;MACpB;IACJ;EACJ,CAAC,EACD;IACIC,QAAQ,EAAE;MACNP,KAAK,EAAE,WAAW;MAClBC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV;IACJ;EACJ,CAAC,CACJ;AACL,CAAC;AAOD;AACA;AACA;AACO,MAAMM,iBAAiB,GAC1BC,EAAa,IAC4C;EACzD,IAAI,CAACA,EAAE,EAAE;IACL,OAAOX,kBAAkB,CAAC,CAAC;EAC/B;EAEA,OAAOW,EAAE,CAACX,kBAAkB,CAAC,CAAC,CAAC;AACnC,CAAC;AAACY,OAAA,CAAAF,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./base\";\nexport * from \"./common\";\nexport * from \"./japanese\";\n"],"mappings":";;;;;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","ignoreList":[]}
|
|
@@ -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,
|
|
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 type { 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,C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mBAAmB,EAAE,WAAW;UAC7C;QACJ,CAAC;QACDU,OAAO,EAAE;UACLrB,IAAI,EAAE;QACV,CAAC;QACDsB,cAAc,EAAE;UACZtB,IAAI,EAAE;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+C,OAAA,CAAAF,wBAAA,GAAAA,wBAAA","ignoreList":[]}
|
package/indexPrefix.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getElasticsearchIndexPrefix: () => string;
|
package/indexPrefix.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getElasticsearchIndexPrefix = void 0;
|
|
7
|
+
const getElasticsearchIndexPrefix = () => {
|
|
8
|
+
return process.env.ELASTIC_SEARCH_INDEX_PREFIX || process.env.WEBINY_ELASTIC_SEARCH_INDEX_PREFIX || "";
|
|
9
|
+
};
|
|
10
|
+
exports.getElasticsearchIndexPrefix = getElasticsearchIndexPrefix;
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=indexPrefix.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getElasticsearchIndexPrefix","process","env","ELASTIC_SEARCH_INDEX_PREFIX","WEBINY_ELASTIC_SEARCH_INDEX_PREFIX","exports"],"sources":["indexPrefix.ts"],"sourcesContent":["export const getElasticsearchIndexPrefix = (): string => {\n return (\n process.env.ELASTIC_SEARCH_INDEX_PREFIX ||\n process.env.WEBINY_ELASTIC_SEARCH_INDEX_PREFIX ||\n \"\"\n );\n};\n"],"mappings":";;;;;;AAAO,MAAMA,2BAA2B,GAAGA,CAAA,KAAc;EACrD,OACIC,OAAO,CAACC,GAAG,CAACC,2BAA2B,IACvCF,OAAO,CAACC,GAAG,CAACE,kCAAkC,IAC9C,EAAE;AAEV,CAAC;AAACC,OAAA,CAAAL,2BAAA,GAAAA,2BAAA","ignoreList":[]}
|