@webiny/api-headless-cms-ddb-es 0.0.0-unstable.97a151f74d → 0.0.0-unstable.99666aeb00
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/configurations.d.ts +1 -1
- package/configurations.js +0 -8
- package/configurations.js.map +1 -1
- package/definitions/entry.js +6 -5
- package/definitions/entry.js.map +1 -1
- package/definitions/entryElasticsearch.js +0 -5
- package/definitions/entryElasticsearch.js.map +1 -1
- package/definitions/group.js +0 -5
- package/definitions/group.js.map +1 -1
- package/definitions/model.js +17 -5
- package/definitions/model.js.map +1 -1
- package/definitions/settings.js +0 -5
- package/definitions/settings.js.map +1 -1
- package/definitions/system.js +0 -5
- package/definitions/system.js.map +1 -1
- package/definitions/table.js +0 -3
- package/definitions/table.js.map +1 -1
- package/definitions/tableElasticsearch.js +0 -3
- package/definitions/tableElasticsearch.js.map +1 -1
- package/dynamoDb/index.js +0 -5
- package/dynamoDb/index.js.map +1 -1
- package/dynamoDb/storage/date.js +5 -27
- package/dynamoDb/storage/date.js.map +1 -1
- package/dynamoDb/storage/longText.js +10 -18
- package/dynamoDb/storage/longText.js.map +1 -1
- package/dynamoDb/storage/richText.js +12 -35
- package/dynamoDb/storage/richText.js.map +1 -1
- package/elasticsearch/createElasticsearchIndex.js +0 -11
- package/elasticsearch/createElasticsearchIndex.js.map +1 -1
- package/elasticsearch/deleteElasticsearchIndex.js +0 -7
- package/elasticsearch/deleteElasticsearchIndex.js.map +1 -1
- package/elasticsearch/index.js +0 -5
- package/elasticsearch/index.js.map +1 -1
- package/elasticsearch/indexing/dateTimeIndexing.js +8 -23
- package/elasticsearch/indexing/dateTimeIndexing.js.map +1 -1
- package/elasticsearch/indexing/defaultFieldIndexing.js +15 -10
- package/elasticsearch/indexing/defaultFieldIndexing.js.map +1 -1
- package/elasticsearch/indexing/index.js +0 -9
- package/elasticsearch/indexing/index.js.map +1 -1
- package/elasticsearch/indexing/longTextIndexing.js +2 -14
- package/elasticsearch/indexing/longTextIndexing.js.map +1 -1
- package/elasticsearch/indexing/numberIndexing.js +0 -9
- package/elasticsearch/indexing/numberIndexing.js.map +1 -1
- package/elasticsearch/indexing/objectIndexing.js +19 -37
- package/elasticsearch/indexing/objectIndexing.js.map +1 -1
- package/elasticsearch/indexing/richTextIndexing.js +0 -5
- package/elasticsearch/indexing/richTextIndexing.js.map +1 -1
- package/elasticsearch/indices/base.js +0 -3
- package/elasticsearch/indices/base.js.map +1 -1
- package/elasticsearch/indices/index.js +0 -4
- package/elasticsearch/indices/index.js.map +1 -1
- package/elasticsearch/indices/japanese.js +0 -3
- package/elasticsearch/indices/japanese.js.map +1 -1
- package/elasticsearch/search/index.js +0 -4
- package/elasticsearch/search/index.js.map +1 -1
- package/elasticsearch/search/refSearch.js +0 -6
- package/elasticsearch/search/refSearch.js.map +1 -1
- package/elasticsearch/search/timeSearch.js +0 -7
- package/elasticsearch/search/timeSearch.js.map +1 -1
- package/helpers/entryIndexHelpers.js +37 -57
- package/helpers/entryIndexHelpers.js.map +1 -1
- package/helpers/fieldIdentifier.d.ts +6 -0
- package/helpers/fieldIdentifier.js +39 -0
- package/helpers/fieldIdentifier.js.map +1 -0
- package/helpers/index.d.ts +1 -0
- package/helpers/index.js +11 -2
- package/helpers/index.js.map +1 -1
- package/index.js +20 -78
- package/index.js.map +1 -1
- package/operations/entry/dataLoader/DataLoaderCache.d.ts +17 -0
- package/operations/entry/dataLoader/DataLoaderCache.js +43 -0
- package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -0
- package/operations/entry/dataLoader/constants.d.ts +1 -0
- package/operations/entry/dataLoader/constants.js +9 -0
- package/operations/entry/dataLoader/constants.js.map +1 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.d.ts +8 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.js +23 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +4 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.js +43 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +4 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +53 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +4 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +53 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -0
- package/operations/entry/dataLoader/getRevisionById.d.ts +4 -0
- package/operations/entry/dataLoader/getRevisionById.js +63 -0
- package/operations/entry/dataLoader/getRevisionById.js.map +1 -0
- package/operations/entry/dataLoader/index.d.ts +8 -0
- package/operations/entry/dataLoader/index.js +38 -0
- package/operations/entry/dataLoader/index.js.map +1 -0
- package/operations/entry/dataLoader/types.d.ts +6 -0
- package/operations/entry/dataLoader/types.js +5 -0
- package/operations/entry/dataLoader/types.js.map +1 -0
- package/operations/entry/dataLoaders.d.ts +15 -36
- package/operations/entry/dataLoaders.js +42 -292
- package/operations/entry/dataLoaders.js.map +1 -1
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +18 -0
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +32 -0
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +1 -0
- package/operations/entry/elasticsearch/body.js +8 -30
- package/operations/entry/elasticsearch/body.js.map +1 -1
- package/operations/entry/elasticsearch/fields.d.ts +5 -4
- package/operations/entry/elasticsearch/fields.js +112 -60
- package/operations/entry/elasticsearch/fields.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/applyFiltering.js +1 -10
- package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/exec.js +15 -57
- package/operations/entry/elasticsearch/filtering/exec.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/index.js +0 -2
- package/operations/entry/elasticsearch/filtering/index.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/path.js +1 -9
- package/operations/entry/elasticsearch/filtering/path.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +1 -8
- package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/plugins/index.js +0 -5
- package/operations/entry/elasticsearch/filtering/plugins/index.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +3 -14
- package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +0 -10
- package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/populated.js +0 -7
- package/operations/entry/elasticsearch/filtering/populated.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/values.js +0 -6
- package/operations/entry/elasticsearch/filtering/values.js.map +1 -1
- package/operations/entry/elasticsearch/fullTextSearch.d.ts +4 -1
- package/operations/entry/elasticsearch/fullTextSearch.js +70 -15
- package/operations/entry/elasticsearch/fullTextSearch.js.map +1 -1
- package/operations/entry/elasticsearch/fullTextSearchFields.js +8 -35
- package/operations/entry/elasticsearch/fullTextSearchFields.js.map +1 -1
- package/operations/entry/elasticsearch/initialQuery.js +5 -19
- package/operations/entry/elasticsearch/initialQuery.js.map +1 -1
- package/operations/entry/elasticsearch/keyword.js +0 -4
- package/operations/entry/elasticsearch/keyword.js.map +1 -1
- package/operations/entry/elasticsearch/plugins/bodyModifier.js +0 -3
- package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +1 -1
- package/operations/entry/elasticsearch/plugins/operator.js +0 -8
- package/operations/entry/elasticsearch/plugins/operator.js.map +1 -1
- package/operations/entry/elasticsearch/plugins/queryModifier.js +0 -3
- package/operations/entry/elasticsearch/plugins/queryModifier.js.map +1 -1
- package/operations/entry/elasticsearch/plugins/search.js +0 -6
- package/operations/entry/elasticsearch/plugins/search.js.map +1 -1
- package/operations/entry/elasticsearch/plugins/sortModifier.js +0 -3
- package/operations/entry/elasticsearch/plugins/sortModifier.js.map +1 -1
- package/operations/entry/elasticsearch/sort.js +9 -20
- package/operations/entry/elasticsearch/sort.js.map +1 -1
- package/operations/entry/elasticsearch/transformValueForSearch.js +0 -4
- package/operations/entry/elasticsearch/transformValueForSearch.js.map +1 -1
- package/operations/entry/elasticsearch/types.d.ts +3 -3
- package/operations/entry/elasticsearch/types.js.map +1 -1
- package/operations/entry/index.d.ts +1 -1
- package/operations/entry/index.js +238 -172
- package/operations/entry/index.js.map +1 -1
- package/operations/entry/keys.js +0 -9
- package/operations/entry/keys.js.map +1 -1
- package/operations/entry/recordType.js +0 -6
- package/operations/entry/recordType.js.map +1 -1
- package/operations/group/index.js +2 -32
- package/operations/group/index.js.map +1 -1
- package/operations/model/index.js +1 -34
- package/operations/model/index.js.map +1 -1
- package/operations/settings/index.js +0 -24
- package/operations/settings/index.js.map +1 -1
- package/operations/system/index.js +0 -17
- package/operations/system/index.js.map +1 -1
- package/package.json +31 -28
- package/plugins/CmsElasticsearchModelFieldPlugin.d.ts +69 -0
- package/plugins/CmsElasticsearchModelFieldPlugin.js +48 -0
- package/plugins/CmsElasticsearchModelFieldPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +1 -0
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +6 -8
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +1 -1
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.d.ts +23 -0
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +28 -0
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchIndexPlugin.js +0 -5
- package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +1 -1
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +1 -0
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +6 -12
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +1 -1
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +1 -0
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +6 -8
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +1 -1
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +1 -0
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +6 -8
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +1 -1
- package/plugins/CmsEntryFilterPlugin.js +0 -7
- package/plugins/CmsEntryFilterPlugin.js.map +1 -1
- package/plugins/index.d.ts +2 -1
- package/plugins/index.js +22 -23
- package/plugins/index.js.map +1 -1
- package/types.d.ts +11 -2
- package/types.js +0 -5
- package/types.js.map +1 -1
- package/helpers/createElasticsearchQueryBody.d.ts +0 -11
- package/helpers/createElasticsearchQueryBody.js +0 -618
- package/helpers/createElasticsearchQueryBody.js.map +0 -1
- package/helpers/fields.d.ts +0 -19
- package/helpers/fields.js +0 -196
- package/helpers/fields.js.map +0 -1
- package/helpers/searchPluginsList.d.ts +0 -6
- package/helpers/searchPluginsList.js +0 -26
- package/helpers/searchPluginsList.js.map +0 -1
- package/helpers/transformValueForSearch.d.ts +0 -12
- package/helpers/transformValueForSearch.js +0 -29
- package/helpers/transformValueForSearch.js.map +0 -1
- package/operations/entry/elasticsearchFields.d.ts +0 -2
- package/operations/entry/elasticsearchFields.js +0 -38
- package/operations/entry/elasticsearchFields.js.map +0 -1
- package/plugins/CmsEntryElasticsearchFieldPlugin.d.ts +0 -12
- package/plugins/CmsEntryElasticsearchFieldPlugin.js +0 -24
- package/plugins/CmsEntryElasticsearchFieldPlugin.js.map +0 -1
|
@@ -1,48 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.createLongTextStorageTransformPlugin = void 0;
|
|
9
|
-
|
|
10
8
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
11
|
-
|
|
12
9
|
var _gzip = require("@webiny/utils/compression/gzip");
|
|
13
|
-
|
|
14
10
|
var _apiHeadlessCms = require("@webiny/api-headless-cms");
|
|
15
|
-
|
|
16
11
|
/**
|
|
17
12
|
* File is @internal
|
|
18
13
|
*/
|
|
14
|
+
|
|
19
15
|
const GZIP = "gzip";
|
|
20
16
|
const TO_STORAGE_ENCODING = "base64";
|
|
21
17
|
const FROM_STORAGE_ENCODING = "utf8";
|
|
22
|
-
|
|
23
18
|
const convertToBuffer = value => {
|
|
24
19
|
if (typeof value === "string") {
|
|
25
20
|
return Buffer.from(value, TO_STORAGE_ENCODING);
|
|
26
21
|
}
|
|
27
|
-
|
|
28
22
|
return value;
|
|
29
23
|
};
|
|
30
|
-
|
|
31
24
|
const createLongTextStorageTransformPlugin = () => {
|
|
32
|
-
|
|
25
|
+
const plugin = new _apiHeadlessCms.StorageTransformPlugin({
|
|
33
26
|
fieldType: "long-text",
|
|
34
27
|
fromStorage: async ({
|
|
35
28
|
field,
|
|
36
29
|
value: storageValue
|
|
37
30
|
}) => {
|
|
38
31
|
const typeOf = typeof storageValue;
|
|
39
|
-
|
|
40
32
|
if (!storageValue || typeOf === "string" || typeOf === "number" || Array.isArray(storageValue) === true) {
|
|
41
33
|
return storageValue;
|
|
42
34
|
} else if (typeOf !== "object") {
|
|
43
35
|
throw new _error.default(`LongText value received in "fromStorage" function is not an object in field "${field.storageId}" - ${field.fieldId}.`);
|
|
44
36
|
}
|
|
45
|
-
|
|
46
37
|
const {
|
|
47
38
|
compression,
|
|
48
39
|
value,
|
|
@@ -51,7 +42,6 @@ const createLongTextStorageTransformPlugin = () => {
|
|
|
51
42
|
/**
|
|
52
43
|
* Check if possibly undefined, null, empty...
|
|
53
44
|
*/
|
|
54
|
-
|
|
55
45
|
if (!compression) {
|
|
56
46
|
throw new _error.default(`Missing compression in "fromStorage" function in field "${field.storageId}" - ${field.fieldId}.": ${JSON.stringify(storageValue)}.`, "MISSING_COMPRESSION", {
|
|
57
47
|
value: storageValue
|
|
@@ -61,15 +51,12 @@ const createLongTextStorageTransformPlugin = () => {
|
|
|
61
51
|
compression
|
|
62
52
|
});
|
|
63
53
|
}
|
|
64
|
-
|
|
65
54
|
try {
|
|
66
55
|
const buf = await (0, _gzip.decompress)(convertToBuffer(value));
|
|
67
56
|
const result = buf.toString(FROM_STORAGE_ENCODING);
|
|
68
|
-
|
|
69
57
|
if (!isArray) {
|
|
70
58
|
return result;
|
|
71
59
|
}
|
|
72
|
-
|
|
73
60
|
return JSON.parse(result);
|
|
74
61
|
} catch (ex) {
|
|
75
62
|
console.log("Error while transforming long-text.");
|
|
@@ -80,6 +67,12 @@ const createLongTextStorageTransformPlugin = () => {
|
|
|
80
67
|
toStorage: async ({
|
|
81
68
|
value: initialValue
|
|
82
69
|
}) => {
|
|
70
|
+
/**
|
|
71
|
+
* There is a possibility that we are trying to compress already compressed value.
|
|
72
|
+
*/
|
|
73
|
+
if (initialValue && initialValue.hasOwnProperty("compression") === true) {
|
|
74
|
+
return initialValue;
|
|
75
|
+
}
|
|
83
76
|
const isArray = Array.isArray(initialValue);
|
|
84
77
|
const value = isArray ? JSON.stringify(initialValue) : initialValue;
|
|
85
78
|
const compressedValue = await (0, _gzip.compress)(value);
|
|
@@ -87,15 +80,14 @@ const createLongTextStorageTransformPlugin = () => {
|
|
|
87
80
|
compression: GZIP,
|
|
88
81
|
value: compressedValue.toString(TO_STORAGE_ENCODING)
|
|
89
82
|
};
|
|
90
|
-
|
|
91
83
|
if (!isArray) {
|
|
92
84
|
return result;
|
|
93
85
|
}
|
|
94
|
-
|
|
95
86
|
result.isArray = isArray;
|
|
96
87
|
return result;
|
|
97
88
|
}
|
|
98
89
|
});
|
|
90
|
+
plugin.name = plugin.name = `headless-cms.dynamodb.storageTransform.long-text`;
|
|
91
|
+
return plugin;
|
|
99
92
|
};
|
|
100
|
-
|
|
101
93
|
exports.createLongTextStorageTransformPlugin = createLongTextStorageTransformPlugin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["GZIP","TO_STORAGE_ENCODING","FROM_STORAGE_ENCODING","convertToBuffer","value","Buffer","from","createLongTextStorageTransformPlugin","StorageTransformPlugin","fieldType","fromStorage","field","storageValue","typeOf","Array","isArray","WebinyError","storageId","fieldId","compression","JSON","stringify","buf","ungzip","result","toString","parse","ex","console","log","message","toStorage","initialValue","compressedValue","gzip"],"sources":["longText.ts"],"sourcesContent":["/**\n * File is @internal\n */\n\nimport WebinyError from \"@webiny/error\";\nimport { compress as gzip, decompress as ungzip } from \"@webiny/utils/compression/gzip\";\nimport { StorageTransformPlugin } from \"@webiny/api-headless-cms\";\n\nconst GZIP = \"gzip\";\nconst TO_STORAGE_ENCODING = \"base64\";\nconst FROM_STORAGE_ENCODING = \"utf8\";\n\nconst convertToBuffer = (value: string | Buffer): Buffer => {\n if (typeof value === \"string\") {\n return Buffer.from(value, TO_STORAGE_ENCODING);\n }\n return value;\n};\n\nexport interface StorageValue {\n compression: string;\n value: string;\n isArray?: boolean;\n}\n\nexport const createLongTextStorageTransformPlugin = () => {\n
|
|
1
|
+
{"version":3,"names":["GZIP","TO_STORAGE_ENCODING","FROM_STORAGE_ENCODING","convertToBuffer","value","Buffer","from","createLongTextStorageTransformPlugin","plugin","StorageTransformPlugin","fieldType","fromStorage","field","storageValue","typeOf","Array","isArray","WebinyError","storageId","fieldId","compression","JSON","stringify","buf","ungzip","result","toString","parse","ex","console","log","message","toStorage","initialValue","hasOwnProperty","compressedValue","gzip","name"],"sources":["longText.ts"],"sourcesContent":["/**\n * File is @internal\n */\n\nimport WebinyError from \"@webiny/error\";\nimport { compress as gzip, decompress as ungzip } from \"@webiny/utils/compression/gzip\";\nimport { StorageTransformPlugin } from \"@webiny/api-headless-cms\";\n\nconst GZIP = \"gzip\";\nconst TO_STORAGE_ENCODING = \"base64\";\nconst FROM_STORAGE_ENCODING = \"utf8\";\n\nconst convertToBuffer = (value: string | Buffer): Buffer => {\n if (typeof value === \"string\") {\n return Buffer.from(value, TO_STORAGE_ENCODING);\n }\n return value;\n};\n\nexport interface StorageValue {\n compression: string;\n value: string;\n isArray?: boolean;\n}\n\nexport const createLongTextStorageTransformPlugin = () => {\n const plugin = new StorageTransformPlugin<string | string[], StorageValue>({\n fieldType: \"long-text\",\n fromStorage: async ({ field, value: storageValue }) => {\n const typeOf = typeof storageValue;\n if (\n !storageValue ||\n typeOf === \"string\" ||\n typeOf === \"number\" ||\n Array.isArray(storageValue) === true\n ) {\n return storageValue as unknown as string | string[];\n } else if (typeOf !== \"object\") {\n throw new WebinyError(\n `LongText value received in \"fromStorage\" function is not an object in field \"${field.storageId}\" - ${field.fieldId}.`\n );\n }\n const { compression, value, isArray } = storageValue;\n /**\n * Check if possibly undefined, null, empty...\n */\n if (!compression) {\n throw new WebinyError(\n `Missing compression in \"fromStorage\" function in field \"${\n field.storageId\n }\" - ${field.fieldId}.\": ${JSON.stringify(storageValue)}.`,\n \"MISSING_COMPRESSION\",\n {\n value: storageValue\n }\n );\n } else if (compression !== GZIP) {\n throw new WebinyError(\n `This plugin cannot transform something not compressed with \"GZIP\".`,\n \"WRONG_COMPRESSION\",\n {\n compression\n }\n );\n }\n try {\n const buf = await ungzip(convertToBuffer(value));\n const result = buf.toString(FROM_STORAGE_ENCODING);\n if (!isArray) {\n return result;\n }\n return JSON.parse(result);\n } catch (ex) {\n console.log(\"Error while transforming long-text.\");\n console.log(ex.message);\n return \"\";\n }\n },\n toStorage: async ({ value: initialValue }) => {\n /**\n * There is a possibility that we are trying to compress already compressed value.\n */\n if (initialValue && initialValue.hasOwnProperty(\"compression\") === true) {\n return initialValue as any;\n }\n const isArray = Array.isArray(initialValue);\n const value = isArray ? JSON.stringify(initialValue) : initialValue;\n const compressedValue = await gzip(value);\n\n const result: StorageValue = {\n compression: GZIP,\n value: compressedValue.toString(TO_STORAGE_ENCODING)\n };\n if (!isArray) {\n return result;\n }\n result.isArray = isArray;\n return result;\n }\n });\n plugin.name = plugin.name = `headless-cms.dynamodb.storageTransform.long-text`;\n\n return plugin;\n};\n"],"mappings":";;;;;;;AAIA;AACA;AACA;AANA;AACA;AACA;;AAMA,MAAMA,IAAI,GAAG,MAAM;AACnB,MAAMC,mBAAmB,GAAG,QAAQ;AACpC,MAAMC,qBAAqB,GAAG,MAAM;AAEpC,MAAMC,eAAe,GAAIC,KAAsB,IAAa;EACxD,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC3B,OAAOC,MAAM,CAACC,IAAI,CAACF,KAAK,EAAEH,mBAAmB,CAAC;EAClD;EACA,OAAOG,KAAK;AAChB,CAAC;AAQM,MAAMG,oCAAoC,GAAG,MAAM;EACtD,MAAMC,MAAM,GAAG,IAAIC,sCAAsB,CAAkC;IACvEC,SAAS,EAAE,WAAW;IACtBC,WAAW,EAAE,OAAO;MAAEC,KAAK;MAAER,KAAK,EAAES;IAAa,CAAC,KAAK;MACnD,MAAMC,MAAM,GAAG,OAAOD,YAAY;MAClC,IACI,CAACA,YAAY,IACbC,MAAM,KAAK,QAAQ,IACnBA,MAAM,KAAK,QAAQ,IACnBC,KAAK,CAACC,OAAO,CAACH,YAAY,CAAC,KAAK,IAAI,EACtC;QACE,OAAOA,YAAY;MACvB,CAAC,MAAM,IAAIC,MAAM,KAAK,QAAQ,EAAE;QAC5B,MAAM,IAAIG,cAAW,CAChB,gFAA+EL,KAAK,CAACM,SAAU,OAAMN,KAAK,CAACO,OAAQ,GAAE,CACzH;MACL;MACA,MAAM;QAAEC,WAAW;QAAEhB,KAAK;QAAEY;MAAQ,CAAC,GAAGH,YAAY;MACpD;AACZ;AACA;MACY,IAAI,CAACO,WAAW,EAAE;QACd,MAAM,IAAIH,cAAW,CAChB,2DACGL,KAAK,CAACM,SACT,OAAMN,KAAK,CAACO,OAAQ,OAAME,IAAI,CAACC,SAAS,CAACT,YAAY,CAAE,GAAE,EAC1D,qBAAqB,EACrB;UACIT,KAAK,EAAES;QACX,CAAC,CACJ;MACL,CAAC,MAAM,IAAIO,WAAW,KAAKpB,IAAI,EAAE;QAC7B,MAAM,IAAIiB,cAAW,CAChB,oEAAmE,EACpE,mBAAmB,EACnB;UACIG;QACJ,CAAC,CACJ;MACL;MACA,IAAI;QACA,MAAMG,GAAG,GAAG,MAAM,IAAAC,gBAAM,EAACrB,eAAe,CAACC,KAAK,CAAC,CAAC;QAChD,MAAMqB,MAAM,GAAGF,GAAG,CAACG,QAAQ,CAACxB,qBAAqB,CAAC;QAClD,IAAI,CAACc,OAAO,EAAE;UACV,OAAOS,MAAM;QACjB;QACA,OAAOJ,IAAI,CAACM,KAAK,CAACF,MAAM,CAAC;MAC7B,CAAC,CAAC,OAAOG,EAAE,EAAE;QACTC,OAAO,CAACC,GAAG,CAAC,qCAAqC,CAAC;QAClDD,OAAO,CAACC,GAAG,CAACF,EAAE,CAACG,OAAO,CAAC;QACvB,OAAO,EAAE;MACb;IACJ,CAAC;IACDC,SAAS,EAAE,OAAO;MAAE5B,KAAK,EAAE6B;IAAa,CAAC,KAAK;MAC1C;AACZ;AACA;MACY,IAAIA,YAAY,IAAIA,YAAY,CAACC,cAAc,CAAC,aAAa,CAAC,KAAK,IAAI,EAAE;QACrE,OAAOD,YAAY;MACvB;MACA,MAAMjB,OAAO,GAAGD,KAAK,CAACC,OAAO,CAACiB,YAAY,CAAC;MAC3C,MAAM7B,KAAK,GAAGY,OAAO,GAAGK,IAAI,CAACC,SAAS,CAACW,YAAY,CAAC,GAAGA,YAAY;MACnE,MAAME,eAAe,GAAG,MAAM,IAAAC,cAAI,EAAChC,KAAK,CAAC;MAEzC,MAAMqB,MAAoB,GAAG;QACzBL,WAAW,EAAEpB,IAAI;QACjBI,KAAK,EAAE+B,eAAe,CAACT,QAAQ,CAACzB,mBAAmB;MACvD,CAAC;MACD,IAAI,CAACe,OAAO,EAAE;QACV,OAAOS,MAAM;MACjB;MACAA,MAAM,CAACT,OAAO,GAAGA,OAAO;MACxB,OAAOS,MAAM;IACjB;EACJ,CAAC,CAAC;EACFjB,MAAM,CAAC6B,IAAI,GAAG7B,MAAM,CAAC6B,IAAI,GAAI,kDAAiD;EAE9E,OAAO7B,MAAM;AACjB,CAAC;AAAC"}
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.createRichTextStorageTransformPlugin = void 0;
|
|
9
|
-
|
|
10
8
|
var _jsonpack = _interopRequireDefault(require("jsonpack"));
|
|
11
|
-
|
|
12
9
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
13
|
-
|
|
14
10
|
var _apiHeadlessCms = require("@webiny/api-headless-cms");
|
|
15
|
-
|
|
16
11
|
/**
|
|
17
12
|
* Remove when jsonpack gets PR with a fix merged
|
|
18
13
|
* https://github.com/rgcl/jsonpack/pull/25/files
|
|
@@ -23,26 +18,21 @@ const transformArray = value => {
|
|
|
23
18
|
if (!value) {
|
|
24
19
|
return value;
|
|
25
20
|
}
|
|
26
|
-
|
|
27
21
|
let isArray = Array.isArray(value);
|
|
28
22
|
const shouldBeArray = value instanceof Array === false && isArray;
|
|
29
|
-
|
|
30
23
|
if (shouldBeArray) {
|
|
31
24
|
value = Array.from(value);
|
|
32
25
|
isArray = true;
|
|
33
26
|
}
|
|
34
|
-
|
|
35
27
|
if (typeof value === "object" || isArray) {
|
|
36
28
|
for (const k in value) {
|
|
37
29
|
value[k] = transformArray(value[k]);
|
|
38
30
|
}
|
|
39
31
|
}
|
|
40
|
-
|
|
41
32
|
return value;
|
|
42
33
|
};
|
|
43
|
-
|
|
44
34
|
const createRichTextStorageTransformPlugin = () => {
|
|
45
|
-
|
|
35
|
+
const plugin = new _apiHeadlessCms.StorageTransformPlugin({
|
|
46
36
|
fieldType: "rich-text",
|
|
47
37
|
fromStorage: async ({
|
|
48
38
|
field,
|
|
@@ -57,72 +47,59 @@ const createRichTextStorageTransformPlugin = () => {
|
|
|
57
47
|
* This is to circumvent a bug introduced with 5.8.0 storage operations.
|
|
58
48
|
* Do not remove.
|
|
59
49
|
*/
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (storageValue.hasOwnProperty("compression") === false) {
|
|
50
|
+
if (!storageValue["compression"]) {
|
|
63
51
|
return storageValue;
|
|
64
52
|
}
|
|
65
|
-
|
|
66
53
|
const {
|
|
67
54
|
compression,
|
|
68
55
|
value
|
|
69
56
|
} = storageValue;
|
|
70
|
-
|
|
71
|
-
if (!compression) {
|
|
72
|
-
throw new _error.default(`Missing compression in "fromStorage" function in field "${field.storageId}": ${JSON.stringify(storageValue)}.`, "MISSING_COMPRESSION", {
|
|
73
|
-
value: storageValue
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
|
|
77
57
|
if (compression !== "jsonpack") {
|
|
78
58
|
throw new _error.default(`This plugin cannot transform something not packed with "jsonpack".`, "WRONG_COMPRESSION", {
|
|
79
59
|
compression
|
|
80
60
|
});
|
|
81
61
|
}
|
|
82
|
-
|
|
62
|
+
/**
|
|
63
|
+
* No point in going further if no value.
|
|
64
|
+
*/
|
|
65
|
+
if (!value) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
83
68
|
try {
|
|
84
69
|
return _jsonpack.default.unpack(value);
|
|
85
70
|
} catch (ex) {
|
|
86
|
-
if (process.env.DEBUG !== "true") {
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
console.log("Error while decompressing rich-text.");
|
|
91
|
-
console.log(ex.message);
|
|
92
71
|
return null;
|
|
93
72
|
}
|
|
94
73
|
},
|
|
95
74
|
toStorage: async ({
|
|
96
75
|
value
|
|
97
76
|
}) => {
|
|
77
|
+
var _value;
|
|
98
78
|
/**
|
|
99
79
|
* There is a possibility that we are trying to compress already compressed value.
|
|
100
80
|
* Introduced a bug with 5.8.0 storage operations, so just return the value to correct it.
|
|
101
81
|
*/
|
|
102
|
-
if (value &&
|
|
82
|
+
if (!!((_value = value) !== null && _value !== void 0 && _value.compression)) {
|
|
103
83
|
return value;
|
|
104
84
|
}
|
|
105
|
-
|
|
106
85
|
value = transformArray(value);
|
|
107
86
|
let jsonValue = null;
|
|
108
|
-
|
|
109
87
|
try {
|
|
110
88
|
jsonValue = _jsonpack.default.pack(value);
|
|
111
89
|
} catch (ex) {
|
|
112
90
|
if (process.env.DEBUG !== "true") {
|
|
113
91
|
return null;
|
|
114
92
|
}
|
|
115
|
-
|
|
116
93
|
console.log("Error while compressing rich-text.");
|
|
117
94
|
console.log(ex.message);
|
|
118
95
|
}
|
|
119
|
-
|
|
120
96
|
return {
|
|
121
97
|
compression: "jsonpack",
|
|
122
98
|
value: jsonValue
|
|
123
99
|
};
|
|
124
100
|
}
|
|
125
101
|
});
|
|
102
|
+
plugin.name = `headless-cms.dynamodb.storageTransform.rich-text`;
|
|
103
|
+
return plugin;
|
|
126
104
|
};
|
|
127
|
-
|
|
128
105
|
exports.createRichTextStorageTransformPlugin = createRichTextStorageTransformPlugin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["transformArray","value","isArray","Array","shouldBeArray","from","k","createRichTextStorageTransformPlugin","StorageTransformPlugin","fieldType","fromStorage","field","storageValue","WebinyError","storageId","
|
|
1
|
+
{"version":3,"names":["transformArray","value","isArray","Array","shouldBeArray","from","k","createRichTextStorageTransformPlugin","plugin","StorageTransformPlugin","fieldType","fromStorage","field","storageValue","WebinyError","storageId","compression","jsonpack","unpack","ex","toStorage","jsonValue","pack","process","env","DEBUG","console","log","message","name"],"sources":["richText.ts"],"sourcesContent":["import jsonpack from \"jsonpack\";\nimport WebinyError from \"@webiny/error\";\nimport { StorageTransformPlugin } from \"@webiny/api-headless-cms\";\n\nexport type OriginalValue = Record<string, any> | any[];\n\nexport interface StorageValue {\n compression: string;\n value: any;\n}\n\n/**\n * Remove when jsonpack gets PR with a fix merged\n * https://github.com/rgcl/jsonpack/pull/25/files\n * NOTE 2021-07-28: it seems PR is not going to be merged so keep this.\n */\n// TODO @ts-refactor figure better type\nconst transformArray = (value: any) => {\n if (!value) {\n return value;\n }\n let isArray = Array.isArray(value);\n const shouldBeArray = value instanceof Array === false && isArray;\n if (shouldBeArray) {\n value = Array.from(value as any);\n isArray = true;\n }\n if (typeof value === \"object\" || isArray) {\n for (const k in value) {\n value[k] = transformArray(value[k]);\n }\n }\n return value;\n};\n\nexport const createRichTextStorageTransformPlugin = () => {\n const plugin = new StorageTransformPlugin({\n fieldType: \"rich-text\",\n fromStorage: async ({ field, value: storageValue }) => {\n if (!storageValue) {\n return storageValue;\n } else if (typeof storageValue !== \"object\") {\n throw new WebinyError(\n `RichText value received in \"fromStorage\" function is not an object in field \"${field.storageId}\".`\n );\n }\n /**\n * This is to circumvent a bug introduced with 5.8.0 storage operations.\n * Do not remove.\n */\n if (!storageValue[\"compression\"]) {\n return storageValue;\n }\n const { compression, value } = storageValue;\n if (compression !== \"jsonpack\") {\n throw new WebinyError(\n `This plugin cannot transform something not packed with \"jsonpack\".`,\n \"WRONG_COMPRESSION\",\n {\n compression\n }\n );\n }\n /**\n * No point in going further if no value.\n */\n if (!value) {\n return null;\n }\n try {\n return jsonpack.unpack(value);\n } catch (ex) {\n return null;\n }\n },\n toStorage: async ({ value }) => {\n /**\n * There is a possibility that we are trying to compress already compressed value.\n * Introduced a bug with 5.8.0 storage operations, so just return the value to correct it.\n */\n if (!!value?.compression) {\n return value as any;\n }\n value = transformArray(value);\n\n let jsonValue: string | null = null;\n try {\n jsonValue = jsonpack.pack(value);\n } catch (ex) {\n if (process.env.DEBUG !== \"true\") {\n return null;\n }\n console.log(\"Error while compressing rich-text.\");\n console.log(ex.message);\n }\n return {\n compression: \"jsonpack\",\n value: jsonValue\n };\n }\n });\n plugin.name = `headless-cms.dynamodb.storageTransform.rich-text`;\n\n return plugin;\n};\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AASA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,cAAc,GAAIC,KAAU,IAAK;EACnC,IAAI,CAACA,KAAK,EAAE;IACR,OAAOA,KAAK;EAChB;EACA,IAAIC,OAAO,GAAGC,KAAK,CAACD,OAAO,CAACD,KAAK,CAAC;EAClC,MAAMG,aAAa,GAAGH,KAAK,YAAYE,KAAK,KAAK,KAAK,IAAID,OAAO;EACjE,IAAIE,aAAa,EAAE;IACfH,KAAK,GAAGE,KAAK,CAACE,IAAI,CAACJ,KAAK,CAAQ;IAChCC,OAAO,GAAG,IAAI;EAClB;EACA,IAAI,OAAOD,KAAK,KAAK,QAAQ,IAAIC,OAAO,EAAE;IACtC,KAAK,MAAMI,CAAC,IAAIL,KAAK,EAAE;MACnBA,KAAK,CAACK,CAAC,CAAC,GAAGN,cAAc,CAACC,KAAK,CAACK,CAAC,CAAC,CAAC;IACvC;EACJ;EACA,OAAOL,KAAK;AAChB,CAAC;AAEM,MAAMM,oCAAoC,GAAG,MAAM;EACtD,MAAMC,MAAM,GAAG,IAAIC,sCAAsB,CAAC;IACtCC,SAAS,EAAE,WAAW;IACtBC,WAAW,EAAE,OAAO;MAAEC,KAAK;MAAEX,KAAK,EAAEY;IAAa,CAAC,KAAK;MACnD,IAAI,CAACA,YAAY,EAAE;QACf,OAAOA,YAAY;MACvB,CAAC,MAAM,IAAI,OAAOA,YAAY,KAAK,QAAQ,EAAE;QACzC,MAAM,IAAIC,cAAW,CAChB,gFAA+EF,KAAK,CAACG,SAAU,IAAG,CACtG;MACL;MACA;AACZ;AACA;AACA;MACY,IAAI,CAACF,YAAY,CAAC,aAAa,CAAC,EAAE;QAC9B,OAAOA,YAAY;MACvB;MACA,MAAM;QAAEG,WAAW;QAAEf;MAAM,CAAC,GAAGY,YAAY;MAC3C,IAAIG,WAAW,KAAK,UAAU,EAAE;QAC5B,MAAM,IAAIF,cAAW,CAChB,oEAAmE,EACpE,mBAAmB,EACnB;UACIE;QACJ,CAAC,CACJ;MACL;MACA;AACZ;AACA;MACY,IAAI,CAACf,KAAK,EAAE;QACR,OAAO,IAAI;MACf;MACA,IAAI;QACA,OAAOgB,iBAAQ,CAACC,MAAM,CAACjB,KAAK,CAAC;MACjC,CAAC,CAAC,OAAOkB,EAAE,EAAE;QACT,OAAO,IAAI;MACf;IACJ,CAAC;IACDC,SAAS,EAAE,OAAO;MAAEnB;IAAM,CAAC,KAAK;MAAA;MAC5B;AACZ;AACA;AACA;MACY,IAAI,CAAC,YAACA,KAAK,mCAAL,OAAOe,WAAW,GAAE;QACtB,OAAOf,KAAK;MAChB;MACAA,KAAK,GAAGD,cAAc,CAACC,KAAK,CAAC;MAE7B,IAAIoB,SAAwB,GAAG,IAAI;MACnC,IAAI;QACAA,SAAS,GAAGJ,iBAAQ,CAACK,IAAI,CAACrB,KAAK,CAAC;MACpC,CAAC,CAAC,OAAOkB,EAAE,EAAE;QACT,IAAII,OAAO,CAACC,GAAG,CAACC,KAAK,KAAK,MAAM,EAAE;UAC9B,OAAO,IAAI;QACf;QACAC,OAAO,CAACC,GAAG,CAAC,oCAAoC,CAAC;QACjDD,OAAO,CAACC,GAAG,CAACR,EAAE,CAACS,OAAO,CAAC;MAC3B;MACA,OAAO;QACHZ,WAAW,EAAE,UAAU;QACvBf,KAAK,EAAEoB;MACX,CAAC;IACL;EACJ,CAAC,CAAC;EACFb,MAAM,CAACqB,IAAI,GAAI,kDAAiD;EAEhE,OAAOrB,MAAM;AACjB,CAAC;AAAC"}
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.createElasticsearchIndex = void 0;
|
|
9
|
-
|
|
10
8
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
11
|
-
|
|
12
9
|
var _CmsEntryElasticsearchIndexPlugin = require("../plugins/CmsEntryElasticsearchIndexPlugin");
|
|
13
|
-
|
|
14
10
|
var _apiElasticsearch = require("@webiny/api-elasticsearch");
|
|
15
|
-
|
|
16
11
|
var _configurations = require("../configurations");
|
|
17
|
-
|
|
18
12
|
const createElasticsearchIndex = async params => {
|
|
19
13
|
const {
|
|
20
14
|
elasticsearch,
|
|
@@ -26,22 +20,18 @@ const createElasticsearchIndex = async params => {
|
|
|
26
20
|
type: _CmsEntryElasticsearchIndexPlugin.CmsEntryElasticsearchIndexPlugin.type,
|
|
27
21
|
locale: model.locale
|
|
28
22
|
});
|
|
29
|
-
|
|
30
23
|
const {
|
|
31
24
|
index
|
|
32
25
|
} = _configurations.configurations.es({
|
|
33
26
|
model
|
|
34
27
|
});
|
|
35
|
-
|
|
36
28
|
try {
|
|
37
29
|
const response = await elasticsearch.indices.exists({
|
|
38
30
|
index
|
|
39
31
|
});
|
|
40
|
-
|
|
41
32
|
if (response.body) {
|
|
42
33
|
return;
|
|
43
34
|
}
|
|
44
|
-
|
|
45
35
|
await elasticsearch.indices.create({
|
|
46
36
|
index,
|
|
47
37
|
body: plugin.body
|
|
@@ -56,5 +46,4 @@ const createElasticsearchIndex = async params => {
|
|
|
56
46
|
});
|
|
57
47
|
}
|
|
58
48
|
};
|
|
59
|
-
|
|
60
49
|
exports.createElasticsearchIndex = createElasticsearchIndex;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createElasticsearchIndex","params","elasticsearch","plugins","container","model","plugin","getLastAddedIndexPlugin","type","CmsEntryElasticsearchIndexPlugin","locale","index","configurations","es","response","indices","exists","body","create","ex","WebinyError","message","code","error","tenant"],"sources":["createElasticsearchIndex.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { Client } from \"@elastic/elasticsearch\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { CmsEntryElasticsearchIndexPlugin } from \"~/plugins/CmsEntryElasticsearchIndexPlugin\";\nimport { getLastAddedIndexPlugin } from \"@webiny/api-elasticsearch\";\nimport { configurations } from \"~/configurations\";\nimport { CmsModel } from \"@webiny/api-headless-cms/types\";\n\nexport interface CreateElasticsearchIndexParams {\n elasticsearch: Client;\n plugins: PluginsContainer;\n model: CmsModel;\n}\n\nexport const createElasticsearchIndex = async (params: CreateElasticsearchIndexParams) => {\n const { elasticsearch, plugins: container, model } = params;\n\n const plugin = getLastAddedIndexPlugin<CmsEntryElasticsearchIndexPlugin>({\n container,\n type: CmsEntryElasticsearchIndexPlugin.type,\n locale: model.locale\n });\n\n const { index } = configurations.es({\n model\n });\n\n try {\n const response = await elasticsearch.indices.exists({\n index\n });\n if (response.body) {\n return;\n }\n await elasticsearch.indices.create({\n index,\n body: plugin.body\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create Elasticsearch index for the Headless CMS model.\",\n ex.code || \"CMS_ELASTICSEARCH_INDEX_ERROR\",\n {\n error: ex,\n type: CmsEntryElasticsearchIndexPlugin.type,\n locale: model.locale,\n tenant: model.tenant,\n body: plugin.body\n }\n );\n }\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["createElasticsearchIndex","params","elasticsearch","plugins","container","model","plugin","getLastAddedIndexPlugin","type","CmsEntryElasticsearchIndexPlugin","locale","index","configurations","es","response","indices","exists","body","create","ex","WebinyError","message","code","error","tenant"],"sources":["createElasticsearchIndex.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { Client } from \"@elastic/elasticsearch\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { CmsEntryElasticsearchIndexPlugin } from \"~/plugins/CmsEntryElasticsearchIndexPlugin\";\nimport { getLastAddedIndexPlugin } from \"@webiny/api-elasticsearch\";\nimport { configurations } from \"~/configurations\";\nimport { CmsModel } from \"@webiny/api-headless-cms/types\";\n\nexport interface CreateElasticsearchIndexParams {\n elasticsearch: Client;\n plugins: PluginsContainer;\n model: CmsModel;\n}\n\nexport const createElasticsearchIndex = async (params: CreateElasticsearchIndexParams) => {\n const { elasticsearch, plugins: container, model } = params;\n\n const plugin = getLastAddedIndexPlugin<CmsEntryElasticsearchIndexPlugin>({\n container,\n type: CmsEntryElasticsearchIndexPlugin.type,\n locale: model.locale\n });\n\n const { index } = configurations.es({\n model\n });\n\n try {\n const response = await elasticsearch.indices.exists({\n index\n });\n if (response.body) {\n return;\n }\n await elasticsearch.indices.create({\n index,\n body: plugin.body\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create Elasticsearch index for the Headless CMS model.\",\n ex.code || \"CMS_ELASTICSEARCH_INDEX_ERROR\",\n {\n error: ex,\n type: CmsEntryElasticsearchIndexPlugin.type,\n locale: model.locale,\n tenant: model.tenant,\n body: plugin.body\n }\n );\n }\n};\n"],"mappings":";;;;;;;AAAA;AAGA;AACA;AACA;AASO,MAAMA,wBAAwB,GAAG,MAAOC,MAAsC,IAAK;EACtF,MAAM;IAAEC,aAAa;IAAEC,OAAO,EAAEC,SAAS;IAAEC;EAAM,CAAC,GAAGJ,MAAM;EAE3D,MAAMK,MAAM,GAAG,IAAAC,yCAAuB,EAAmC;IACrEH,SAAS;IACTI,IAAI,EAAEC,kEAAgC,CAACD,IAAI;IAC3CE,MAAM,EAAEL,KAAK,CAACK;EAClB,CAAC,CAAC;EAEF,MAAM;IAAEC;EAAM,CAAC,GAAGC,8BAAc,CAACC,EAAE,CAAC;IAChCR;EACJ,CAAC,CAAC;EAEF,IAAI;IACA,MAAMS,QAAQ,GAAG,MAAMZ,aAAa,CAACa,OAAO,CAACC,MAAM,CAAC;MAChDL;IACJ,CAAC,CAAC;IACF,IAAIG,QAAQ,CAACG,IAAI,EAAE;MACf;IACJ;IACA,MAAMf,aAAa,CAACa,OAAO,CAACG,MAAM,CAAC;MAC/BP,KAAK;MACLM,IAAI,EAAEX,MAAM,CAACW;IACjB,CAAC,CAAC;EACN,CAAC,CAAC,OAAOE,EAAE,EAAE;IACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,kEAAkE,EAChFF,EAAE,CAACG,IAAI,IAAI,+BAA+B,EAC1C;MACIC,KAAK,EAAEJ,EAAE;MACTX,IAAI,EAAEC,kEAAgC,CAACD,IAAI;MAC3CE,MAAM,EAAEL,KAAK,CAACK,MAAM;MACpBc,MAAM,EAAEnB,KAAK,CAACmB,MAAM;MACpBP,IAAI,EAAEX,MAAM,CAACW;IACjB,CAAC,CACJ;EACL;AACJ,CAAC;AAAC"}
|
|
@@ -4,31 +4,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.deleteElasticsearchIndex = void 0;
|
|
7
|
-
|
|
8
7
|
var _configurations = require("../configurations");
|
|
9
|
-
|
|
10
8
|
const deleteElasticsearchIndex = async params => {
|
|
11
9
|
const {
|
|
12
10
|
elasticsearch,
|
|
13
11
|
model
|
|
14
12
|
} = params;
|
|
15
|
-
|
|
16
13
|
const {
|
|
17
14
|
index
|
|
18
15
|
} = _configurations.configurations.es({
|
|
19
16
|
model
|
|
20
17
|
});
|
|
21
|
-
|
|
22
18
|
const {
|
|
23
19
|
body: exists
|
|
24
20
|
} = await elasticsearch.indices.exists({
|
|
25
21
|
index
|
|
26
22
|
});
|
|
27
|
-
|
|
28
23
|
if (!exists) {
|
|
29
24
|
return;
|
|
30
25
|
}
|
|
31
|
-
|
|
32
26
|
try {
|
|
33
27
|
await elasticsearch.indices.delete({
|
|
34
28
|
index,
|
|
@@ -39,5 +33,4 @@ const deleteElasticsearchIndex = async params => {
|
|
|
39
33
|
console.log(ex.message);
|
|
40
34
|
}
|
|
41
35
|
};
|
|
42
|
-
|
|
43
36
|
exports.deleteElasticsearchIndex = deleteElasticsearchIndex;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["deleteElasticsearchIndex","params","elasticsearch","model","index","configurations","es","body","exists","indices","delete","ignore_unavailable","ex","console","log","message"],"sources":["deleteElasticsearchIndex.ts"],"sourcesContent":["import { Client } from \"@elastic/elasticsearch\";\nimport { CmsModel } from \"@webiny/api-headless-cms/types\";\nimport { configurations } from \"~/configurations\";\n\ninterface DeleteElasticsearchIndexParams {\n elasticsearch: Client;\n model: CmsModel;\n}\n\nexport const deleteElasticsearchIndex = async (\n params: DeleteElasticsearchIndexParams\n): Promise<void> => {\n const { elasticsearch, model } = params;\n\n const { index } = configurations.es({\n model\n });\n const { body: exists } = await elasticsearch.indices.exists({\n index\n });\n if (!exists) {\n return;\n }\n\n try {\n await elasticsearch.indices.delete({\n index,\n ignore_unavailable: true\n });\n } catch (ex) {\n console.log(`Could not delete Elasticsearch index \"${index}\". Please do it manually.`);\n console.log(ex.message);\n }\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["deleteElasticsearchIndex","params","elasticsearch","model","index","configurations","es","body","exists","indices","delete","ignore_unavailable","ex","console","log","message"],"sources":["deleteElasticsearchIndex.ts"],"sourcesContent":["import { Client } from \"@elastic/elasticsearch\";\nimport { CmsModel } from \"@webiny/api-headless-cms/types\";\nimport { configurations } from \"~/configurations\";\n\ninterface DeleteElasticsearchIndexParams {\n elasticsearch: Client;\n model: CmsModel;\n}\n\nexport const deleteElasticsearchIndex = async (\n params: DeleteElasticsearchIndexParams\n): Promise<void> => {\n const { elasticsearch, model } = params;\n\n const { index } = configurations.es({\n model\n });\n const { body: exists } = await elasticsearch.indices.exists({\n index\n });\n if (!exists) {\n return;\n }\n\n try {\n await elasticsearch.indices.delete({\n index,\n ignore_unavailable: true\n });\n } catch (ex) {\n console.log(`Could not delete Elasticsearch index \"${index}\". Please do it manually.`);\n console.log(ex.message);\n }\n};\n"],"mappings":";;;;;;AAEA;AAOO,MAAMA,wBAAwB,GAAG,MACpCC,MAAsC,IACtB;EAChB,MAAM;IAAEC,aAAa;IAAEC;EAAM,CAAC,GAAGF,MAAM;EAEvC,MAAM;IAAEG;EAAM,CAAC,GAAGC,8BAAc,CAACC,EAAE,CAAC;IAChCH;EACJ,CAAC,CAAC;EACF,MAAM;IAAEI,IAAI,EAAEC;EAAO,CAAC,GAAG,MAAMN,aAAa,CAACO,OAAO,CAACD,MAAM,CAAC;IACxDJ;EACJ,CAAC,CAAC;EACF,IAAI,CAACI,MAAM,EAAE;IACT;EACJ;EAEA,IAAI;IACA,MAAMN,aAAa,CAACO,OAAO,CAACC,MAAM,CAAC;MAC/BN,KAAK;MACLO,kBAAkB,EAAE;IACxB,CAAC,CAAC;EACN,CAAC,CAAC,OAAOC,EAAE,EAAE;IACTC,OAAO,CAACC,GAAG,CAAE,yCAAwCV,KAAM,2BAA0B,CAAC;IACtFS,OAAO,CAACC,GAAG,CAACF,EAAE,CAACG,OAAO,CAAC;EAC3B;AACJ,CAAC;AAAC"}
|
package/elasticsearch/index.js
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _indexing = _interopRequireDefault(require("./indexing"));
|
|
11
|
-
|
|
12
9
|
var _search = _interopRequireDefault(require("./search"));
|
|
13
|
-
|
|
14
10
|
var _default = () => [(0, _indexing.default)(), (0, _search.default)()];
|
|
15
|
-
|
|
16
11
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["elasticsearchIndexingPlugins","elasticsearchSearchPlugins"],"sources":["index.ts"],"sourcesContent":["import elasticsearchIndexingPlugins from \"./indexing\";\nimport elasticsearchSearchPlugins from \"./search\";\n\nexport default () => [elasticsearchIndexingPlugins(), elasticsearchSearchPlugins()];\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["elasticsearchIndexingPlugins","elasticsearchSearchPlugins"],"sources":["index.ts"],"sourcesContent":["import elasticsearchIndexingPlugins from \"./indexing\";\nimport elasticsearchSearchPlugins from \"./search\";\n\nexport default () => [elasticsearchIndexingPlugins(), elasticsearchSearchPlugins()];\n"],"mappings":";;;;;;;AAAA;AACA;AAAkD,eAEnC,MAAM,CAAC,IAAAA,iBAA4B,GAAE,EAAE,IAAAC,eAA0B,GAAE,CAAC;AAAA"}
|
|
@@ -4,37 +4,31 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
const convertTimeToNumber = time => {
|
|
9
8
|
if (!time) {
|
|
10
9
|
return null;
|
|
11
10
|
}
|
|
12
|
-
|
|
13
11
|
const [hours, minutes, seconds = 0] = time.split(":").map(Number);
|
|
14
12
|
return hours * 60 * 60 + minutes * 60 + seconds;
|
|
15
13
|
};
|
|
16
|
-
|
|
17
14
|
const convertNumberToTime = value => {
|
|
18
15
|
if (value === undefined || value === null) {
|
|
19
16
|
return null;
|
|
20
|
-
}
|
|
17
|
+
}
|
|
18
|
+
// TODO remove when v5 goes out
|
|
21
19
|
// this is a fix for pre beta.5
|
|
22
|
-
|
|
23
|
-
|
|
24
20
|
if (String(value).match(/^([0-9]{2}):([0-9]{2})/) !== null) {
|
|
25
21
|
return String(value);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
}
|
|
23
|
+
//
|
|
29
24
|
const hours = Math.floor(value / 60 / 60);
|
|
30
25
|
const minutes = Math.floor((value - hours * 60 * 60) / 60);
|
|
31
26
|
const seconds = Math.floor(value - hours * 60 * 60 - minutes * 60);
|
|
32
27
|
return [hours, minutes, seconds].map(v => String(v).padStart(2, "0")).join(":");
|
|
33
28
|
};
|
|
34
|
-
|
|
35
29
|
const convertValueFromIndex = (value, field) => {
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
var _field$settings;
|
|
31
|
+
const type = (_field$settings = field.settings) === null || _field$settings === void 0 ? void 0 : _field$settings.type;
|
|
38
32
|
if (type === "time") {
|
|
39
33
|
return convertNumberToTime(value);
|
|
40
34
|
} else if (!value) {
|
|
@@ -45,20 +39,17 @@ const convertValueFromIndex = (value, field) => {
|
|
|
45
39
|
const dateValue = new Date(value);
|
|
46
40
|
return dateValue.toISOString().slice(0, 10);
|
|
47
41
|
}
|
|
48
|
-
|
|
49
42
|
return new Date(value).toISOString();
|
|
50
43
|
};
|
|
51
|
-
|
|
52
44
|
const convertValueToIndex = (value, field) => {
|
|
45
|
+
var _field$settings2;
|
|
53
46
|
if (!value) {
|
|
54
47
|
return null;
|
|
55
|
-
} else if (field.settings.type === "time") {
|
|
48
|
+
} else if (((_field$settings2 = field.settings) === null || _field$settings2 === void 0 ? void 0 : _field$settings2.type) === "time") {
|
|
56
49
|
return convertTimeToNumber(value);
|
|
57
50
|
}
|
|
58
|
-
|
|
59
51
|
return value;
|
|
60
52
|
};
|
|
61
|
-
|
|
62
53
|
var _default = () => ({
|
|
63
54
|
type: "cms-model-field-to-elastic-search",
|
|
64
55
|
name: "cms-model-field-to-elastic-search-datetime",
|
|
@@ -66,7 +57,6 @@ var _default = () => ({
|
|
|
66
57
|
unmappedType: () => {
|
|
67
58
|
return "date";
|
|
68
59
|
},
|
|
69
|
-
|
|
70
60
|
toIndex({
|
|
71
61
|
field,
|
|
72
62
|
value
|
|
@@ -78,13 +68,11 @@ var _default = () => ({
|
|
|
78
68
|
})
|
|
79
69
|
};
|
|
80
70
|
}
|
|
81
|
-
|
|
82
71
|
const dateValue = convertValueToIndex(value, field);
|
|
83
72
|
return {
|
|
84
73
|
value: dateValue
|
|
85
74
|
};
|
|
86
75
|
},
|
|
87
|
-
|
|
88
76
|
fromIndex({
|
|
89
77
|
field,
|
|
90
78
|
value
|
|
@@ -94,10 +82,7 @@ var _default = () => ({
|
|
|
94
82
|
return convertValueFromIndex(v, field);
|
|
95
83
|
});
|
|
96
84
|
}
|
|
97
|
-
|
|
98
85
|
return convertValueFromIndex(value, field);
|
|
99
86
|
}
|
|
100
|
-
|
|
101
87
|
});
|
|
102
|
-
|
|
103
88
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["convertTimeToNumber","time","hours","minutes","seconds","split","map","Number","convertNumberToTime","value","undefined","String","match","Math","floor","v","padStart","join","convertValueFromIndex","field","type","settings","dateValue","Date","toISOString","slice","convertValueToIndex","name","fieldType","unmappedType","toIndex","Array","isArray","fromIndex"],"sources":["dateTimeIndexing.ts"],"sourcesContent":["import { CmsModelDateTimeField } from \"@webiny/api-headless-cms/types\";\nimport { CmsModelFieldToElasticsearchPlugin } from \"~/types\";\n\nconst convertTimeToNumber = (time?: string): number | null => {\n if (!time) {\n return null;\n }\n const [hours, minutes, seconds = 0] = time.split(\":\").map(Number);\n return hours * 60 * 60 + minutes * 60 + seconds;\n};\n\nconst convertNumberToTime = (value?: number): string | null => {\n if (value === undefined || value === null) {\n return null;\n }\n // TODO remove when v5 goes out\n // this is a fix for pre beta.5\n if (String(value).match(/^([0-9]{2}):([0-9]{2})/) !== null) {\n return String(value);\n }\n //\n const hours = Math.floor(value / 60 / 60);\n\n const minutes = Math.floor((value - hours * 60 * 60) / 60);\n\n const seconds = Math.floor(value - hours * 60 * 60 - minutes * 60);\n\n return [hours, minutes, seconds].map(v => String(v).padStart(2, \"0\")).join(\":\");\n};\n\nconst convertValueFromIndex = (\n value: string | number,\n field: CmsModelDateTimeField\n): string | null => {\n const type = field.settings
|
|
1
|
+
{"version":3,"names":["convertTimeToNumber","time","hours","minutes","seconds","split","map","Number","convertNumberToTime","value","undefined","String","match","Math","floor","v","padStart","join","convertValueFromIndex","field","type","settings","dateValue","Date","toISOString","slice","convertValueToIndex","name","fieldType","unmappedType","toIndex","Array","isArray","fromIndex"],"sources":["dateTimeIndexing.ts"],"sourcesContent":["import { CmsModelDateTimeField } from \"@webiny/api-headless-cms/types\";\nimport { CmsModelFieldToElasticsearchPlugin } from \"~/types\";\n\nconst convertTimeToNumber = (time?: string): number | null => {\n if (!time) {\n return null;\n }\n const [hours, minutes, seconds = 0] = time.split(\":\").map(Number);\n return hours * 60 * 60 + minutes * 60 + seconds;\n};\n\nconst convertNumberToTime = (value?: number): string | null => {\n if (value === undefined || value === null) {\n return null;\n }\n // TODO remove when v5 goes out\n // this is a fix for pre beta.5\n if (String(value).match(/^([0-9]{2}):([0-9]{2})/) !== null) {\n return String(value);\n }\n //\n const hours = Math.floor(value / 60 / 60);\n\n const minutes = Math.floor((value - hours * 60 * 60) / 60);\n\n const seconds = Math.floor(value - hours * 60 * 60 - minutes * 60);\n\n return [hours, minutes, seconds].map(v => String(v).padStart(2, \"0\")).join(\":\");\n};\n\nconst convertValueFromIndex = (\n value: string | number,\n field: CmsModelDateTimeField\n): string | null => {\n const type = field.settings?.type;\n if (type === \"time\") {\n return convertNumberToTime(value as number);\n } else if (!value) {\n return null;\n } else if (type === \"dateTimeWithTimezone\") {\n return value as string;\n } else if (type === \"date\") {\n const dateValue = new Date(value);\n return dateValue.toISOString().slice(0, 10);\n }\n return new Date(value).toISOString();\n};\n\nconst convertValueToIndex = (value: string, field: CmsModelDateTimeField) => {\n if (!value) {\n return null;\n } else if (field.settings?.type === \"time\") {\n return convertTimeToNumber(value);\n }\n return value;\n};\n\nexport default (): CmsModelFieldToElasticsearchPlugin => ({\n type: \"cms-model-field-to-elastic-search\",\n name: \"cms-model-field-to-elastic-search-datetime\",\n fieldType: \"datetime\",\n unmappedType: () => {\n return \"date\";\n },\n toIndex({ field, value }) {\n if (Array.isArray(value) === true) {\n return {\n value: value.map((v: string) => {\n return convertValueToIndex(v, field as CmsModelDateTimeField);\n })\n };\n }\n const dateValue = convertValueToIndex(value, field as CmsModelDateTimeField);\n return {\n value: dateValue\n };\n },\n fromIndex({ field, value }) {\n if (Array.isArray(value)) {\n return value.map((v: string) => {\n return convertValueFromIndex(v, field as CmsModelDateTimeField);\n });\n }\n return convertValueFromIndex(value, field as CmsModelDateTimeField);\n }\n});\n"],"mappings":"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"}
|