@webiny/api-headless-cms-ddb-es 0.0.0-mt-3 → 0.0.0-unstable.06b2ede40f
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 +15 -8
- package/configurations.js +29 -12
- package/configurations.js.map +1 -0
- package/definitions/entry.d.ts +6 -5
- package/definitions/entry.js +111 -20
- package/definitions/entry.js.map +1 -0
- package/definitions/entryElasticsearch.d.ts +6 -5
- package/definitions/entryElasticsearch.js +11 -16
- package/definitions/entryElasticsearch.js.map +1 -0
- package/definitions/group.d.ts +6 -5
- package/definitions/group.js +8 -16
- package/definitions/group.js.map +1 -0
- package/definitions/model.d.ts +6 -5
- package/definitions/model.js +30 -16
- package/definitions/model.js.map +1 -0
- package/definitions/system.d.ts +6 -5
- package/definitions/system.js +8 -16
- package/definitions/system.js.map +1 -0
- package/definitions/table.d.ts +6 -6
- package/definitions/table.js +7 -6
- package/definitions/table.js.map +1 -0
- package/definitions/tableElasticsearch.d.ts +6 -6
- package/definitions/tableElasticsearch.js +7 -6
- package/definitions/tableElasticsearch.js.map +1 -0
- package/dynamoDb/index.d.ts +2 -1
- package/dynamoDb/index.js +10 -12
- package/dynamoDb/index.js.map +1 -0
- package/dynamoDb/storage/longText.d.ts +7 -4
- package/dynamoDb/storage/longText.js +75 -62
- package/dynamoDb/storage/longText.js.map +1 -0
- package/dynamoDb/storage/richText.d.ts +2 -8
- package/dynamoDb/storage/richText.js +49 -100
- package/dynamoDb/storage/richText.js.map +1 -0
- package/elasticsearch/createElasticsearchIndex.d.ts +9 -0
- package/elasticsearch/createElasticsearchIndex.js +40 -0
- package/elasticsearch/createElasticsearchIndex.js.map +1 -0
- package/elasticsearch/deleteElasticsearchIndex.d.ts +8 -0
- package/elasticsearch/deleteElasticsearchIndex.js +38 -0
- package/elasticsearch/deleteElasticsearchIndex.js.map +1 -0
- package/elasticsearch/index.d.ts +1 -1
- package/elasticsearch/index.js +3 -6
- package/elasticsearch/index.js.map +1 -0
- package/elasticsearch/indexing/dateTimeIndexing.d.ts +1 -1
- package/elasticsearch/indexing/dateTimeIndexing.js +21 -22
- package/elasticsearch/indexing/dateTimeIndexing.js.map +1 -0
- package/elasticsearch/indexing/defaultFieldIndexing.d.ts +1 -1
- package/elasticsearch/indexing/defaultFieldIndexing.js +17 -10
- package/elasticsearch/indexing/defaultFieldIndexing.js.map +1 -0
- package/elasticsearch/indexing/index.js +5 -11
- package/elasticsearch/indexing/index.js.map +1 -0
- package/elasticsearch/indexing/jsonIndexing.d.ts +2 -0
- package/elasticsearch/indexing/jsonIndexing.js +28 -0
- package/elasticsearch/indexing/jsonIndexing.js.map +1 -0
- package/elasticsearch/indexing/longTextIndexing.d.ts +5 -1
- package/elasticsearch/indexing/longTextIndexing.js +16 -10
- package/elasticsearch/indexing/longTextIndexing.js.map +1 -0
- package/elasticsearch/indexing/numberIndexing.d.ts +1 -1
- package/elasticsearch/indexing/numberIndexing.js +2 -9
- package/elasticsearch/indexing/numberIndexing.js.map +1 -0
- package/elasticsearch/indexing/objectIndexing.d.ts +10 -1
- package/elasticsearch/indexing/objectIndexing.js +37 -36
- package/elasticsearch/indexing/objectIndexing.js.map +1 -0
- package/elasticsearch/indexing/richTextIndexing.d.ts +1 -1
- package/elasticsearch/indexing/richTextIndexing.js +2 -5
- package/elasticsearch/indexing/richTextIndexing.js.map +1 -0
- package/elasticsearch/indices/base.d.ts +2 -0
- package/elasticsearch/indices/base.js +13 -0
- package/elasticsearch/indices/base.js.map +1 -0
- package/elasticsearch/indices/index.d.ts +1 -0
- package/elasticsearch/indices/index.js +14 -0
- package/elasticsearch/indices/index.js.map +1 -0
- package/elasticsearch/indices/japanese.d.ts +2 -0
- package/elasticsearch/indices/japanese.js +14 -0
- package/elasticsearch/indices/japanese.js.map +1 -0
- package/elasticsearch/search/index.d.ts +2 -2
- package/elasticsearch/search/index.js +6 -9
- package/elasticsearch/search/index.js.map +1 -0
- package/elasticsearch/search/refSearch.d.ts +2 -3
- package/elasticsearch/search/refSearch.js +24 -17
- package/elasticsearch/search/refSearch.js.map +1 -0
- package/elasticsearch/search/searchableJson.d.ts +2 -0
- package/elasticsearch/search/searchableJson.js +60 -0
- package/elasticsearch/search/searchableJson.js.map +1 -0
- package/elasticsearch/search/timeSearch.d.ts +2 -3
- package/elasticsearch/search/timeSearch.js +18 -16
- package/elasticsearch/search/timeSearch.js.map +1 -0
- package/helpers/entryIndexHelpers.d.ts +3 -3
- package/helpers/entryIndexHelpers.js +59 -58
- package/helpers/entryIndexHelpers.js.map +1 -0
- package/helpers/fieldIdentifier.d.ts +6 -0
- package/helpers/fieldIdentifier.js +43 -0
- package/helpers/fieldIdentifier.js.map +1 -0
- package/helpers/index.d.ts +1 -1
- package/helpers/index.js +11 -13
- package/helpers/index.js.map +1 -0
- package/index.d.ts +2 -1
- package/index.js +132 -78
- package/index.js.map +1 -0
- package/operations/entry/dataLoader/DataLoaderCache.d.ts +17 -0
- package/operations/entry/dataLoader/DataLoaderCache.js +41 -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 +10 -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 +25 -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 +45 -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 +52 -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 +52 -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 +62 -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 +40 -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 +7 -0
- package/operations/entry/dataLoader/types.js.map +1 -0
- package/operations/entry/dataLoaders.d.ts +21 -38
- package/operations/entry/dataLoaders.js +59 -290
- package/operations/entry/dataLoaders.js.map +1 -0
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +18 -0
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +34 -0
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +1 -0
- package/operations/entry/elasticsearch/body.d.ts +13 -0
- package/operations/entry/elasticsearch/body.js +142 -0
- package/operations/entry/elasticsearch/body.js.map +1 -0
- package/operations/entry/elasticsearch/fields.d.ts +10 -0
- package/operations/entry/elasticsearch/fields.js +315 -0
- package/operations/entry/elasticsearch/fields.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +8 -0
- package/operations/entry/elasticsearch/filtering/applyFiltering.js +60 -0
- package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/exec.d.ts +17 -0
- package/operations/entry/elasticsearch/filtering/exec.js +175 -0
- package/operations/entry/elasticsearch/filtering/exec.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/index.d.ts +1 -0
- package/operations/entry/elasticsearch/filtering/index.js +18 -0
- package/operations/entry/elasticsearch/filtering/index.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/path.d.ts +16 -0
- package/operations/entry/elasticsearch/filtering/path.js +48 -0
- package/operations/entry/elasticsearch/filtering/path.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.d.ts +2 -0
- package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +30 -0
- package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/plugins/index.d.ts +1 -0
- package/operations/entry/elasticsearch/filtering/plugins/index.js +15 -0
- package/operations/entry/elasticsearch/filtering/plugins/index.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.d.ts +2 -0
- package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +69 -0
- package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.d.ts +2 -0
- package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +57 -0
- package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/populated.d.ts +2 -0
- package/operations/entry/elasticsearch/filtering/populated.js +25 -0
- package/operations/entry/elasticsearch/filtering/populated.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/values.d.ts +2 -0
- package/operations/entry/elasticsearch/filtering/values.js +24 -0
- package/operations/entry/elasticsearch/filtering/values.js.map +1 -0
- package/operations/entry/elasticsearch/fullTextSearch.d.ts +12 -0
- package/operations/entry/elasticsearch/fullTextSearch.js +91 -0
- package/operations/entry/elasticsearch/fullTextSearch.js.map +1 -0
- package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +8 -0
- package/operations/entry/elasticsearch/fullTextSearchFields.js +27 -0
- package/operations/entry/elasticsearch/fullTextSearchFields.js.map +1 -0
- package/operations/entry/elasticsearch/initialQuery.d.ts +17 -0
- package/operations/entry/elasticsearch/initialQuery.js +106 -0
- package/operations/entry/elasticsearch/initialQuery.js.map +1 -0
- package/operations/entry/elasticsearch/keyword.d.ts +2 -0
- package/operations/entry/elasticsearch/keyword.js +36 -0
- package/operations/entry/elasticsearch/keyword.js.map +1 -0
- package/operations/entry/elasticsearch/logIgnoredEsResponseError.d.ts +9 -0
- package/operations/entry/elasticsearch/logIgnoredEsResponseError.js +26 -0
- package/operations/entry/elasticsearch/logIgnoredEsResponseError.js.map +1 -0
- package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +9 -0
- package/operations/entry/elasticsearch/plugins/bodyModifier.js +18 -0
- package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +1 -0
- package/operations/entry/elasticsearch/plugins/operator.d.ts +8 -0
- package/operations/entry/elasticsearch/plugins/operator.js +39 -0
- package/operations/entry/elasticsearch/plugins/operator.js.map +1 -0
- package/operations/entry/elasticsearch/plugins/queryModifier.d.ts +9 -0
- package/operations/entry/elasticsearch/plugins/queryModifier.js +18 -0
- package/operations/entry/elasticsearch/plugins/queryModifier.js.map +1 -0
- package/operations/entry/elasticsearch/plugins/search.d.ts +7 -0
- package/{helpers/searchPluginsList.js → operations/entry/elasticsearch/plugins/search.js} +9 -9
- package/operations/entry/elasticsearch/plugins/search.js.map +1 -0
- package/operations/entry/elasticsearch/plugins/sortModifier.d.ts +9 -0
- package/operations/entry/elasticsearch/plugins/sortModifier.js +18 -0
- package/operations/entry/elasticsearch/plugins/sortModifier.js.map +1 -0
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.d.ts +2 -0
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +13 -0
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js.map +1 -0
- package/operations/entry/elasticsearch/sort.d.ts +12 -0
- package/operations/entry/elasticsearch/sort.js +89 -0
- package/operations/entry/elasticsearch/sort.js.map +1 -0
- package/operations/entry/elasticsearch/transformValueForSearch.d.ts +16 -0
- package/operations/entry/elasticsearch/transformValueForSearch.js +32 -0
- package/operations/entry/elasticsearch/transformValueForSearch.js.map +1 -0
- package/operations/entry/elasticsearch/types.d.ts +41 -0
- package/operations/entry/elasticsearch/types.js +7 -0
- package/operations/entry/elasticsearch/types.js.map +1 -0
- package/operations/entry/index.d.ts +6 -8
- package/operations/entry/index.js +1422 -693
- package/operations/entry/index.js.map +1 -0
- package/operations/entry/keys.js +2 -9
- package/operations/entry/keys.js.map +1 -0
- package/operations/entry/recordType.d.ts +3 -0
- package/operations/entry/recordType.js +20 -0
- package/operations/entry/recordType.js.map +1 -0
- package/operations/entry/transformations/convertEntryKeys.d.ts +8 -0
- package/operations/entry/transformations/convertEntryKeys.js +38 -0
- package/operations/entry/transformations/convertEntryKeys.js.map +1 -0
- package/operations/entry/transformations/index.d.ts +29 -0
- package/operations/entry/transformations/index.js +127 -0
- package/operations/entry/transformations/index.js.map +1 -0
- package/operations/entry/transformations/modifyEntryValues.d.ts +58 -0
- package/operations/entry/transformations/modifyEntryValues.js +28 -0
- package/operations/entry/transformations/modifyEntryValues.js.map +1 -0
- package/operations/entry/transformations/transformEntryKeys.d.ts +11 -0
- package/operations/entry/transformations/transformEntryKeys.js +27 -0
- package/operations/entry/transformations/transformEntryKeys.js.map +1 -0
- package/operations/entry/transformations/transformEntryToIndex.d.ts +10 -0
- package/operations/entry/transformations/transformEntryToIndex.js +31 -0
- package/operations/entry/transformations/transformEntryToIndex.js.map +1 -0
- package/operations/group/index.d.ts +5 -5
- package/operations/group/index.js +40 -63
- package/operations/group/index.js.map +1 -0
- package/operations/model/index.d.ts +5 -5
- package/operations/model/index.js +56 -78
- package/operations/model/index.js.map +1 -0
- package/operations/system/index.d.ts +4 -4
- package/operations/system/index.js +20 -31
- package/operations/system/index.js.map +1 -0
- package/operations/system/indexes.d.ts +10 -0
- package/operations/system/indexes.js +41 -0
- package/operations/system/indexes.js.map +1 -0
- package/package.json +38 -40
- package/plugins/CmsElasticsearchModelFieldPlugin.d.ts +69 -0
- package/plugins/CmsElasticsearchModelFieldPlugin.js +52 -0
- package/plugins/CmsElasticsearchModelFieldPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +9 -4
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +10 -13
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.d.ts +23 -0
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +27 -0
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchIndexPlugin.d.ts +4 -0
- package/plugins/CmsEntryElasticsearchIndexPlugin.js +13 -0
- package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +32 -0
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +40 -0
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +6 -4
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +10 -13
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +6 -4
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +10 -13
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchValuesModifier.d.ts +33 -0
- package/plugins/CmsEntryElasticsearchValuesModifier.js +50 -0
- package/plugins/CmsEntryElasticsearchValuesModifier.js.map +1 -0
- package/plugins/CmsEntryFilterPlugin.d.ts +49 -0
- package/plugins/CmsEntryFilterPlugin.js +22 -0
- package/plugins/CmsEntryFilterPlugin.js.map +1 -0
- package/plugins/index.d.ts +8 -0
- package/plugins/index.js +95 -0
- package/plugins/index.js.map +1 -0
- package/tasks/createIndexTaskPlugin.d.ts +2 -0
- package/tasks/createIndexTaskPlugin.js +67 -0
- package/tasks/createIndexTaskPlugin.js.map +1 -0
- package/types.d.ts +30 -52
- package/types.js +5 -23
- package/types.js.map +1 -0
- package/values/NoValueContainer.d.ts +5 -0
- package/values/NoValueContainer.js +20 -0
- package/values/NoValueContainer.js.map +1 -0
- package/definitions/settings.d.ts +0 -8
- package/definitions/settings.js +0 -62
- package/dynamoDb/storage/date.d.ts +0 -3
- package/dynamoDb/storage/date.js +0 -65
- package/helpers/createElasticsearchQueryBody.d.ts +0 -11
- package/helpers/createElasticsearchQueryBody.js +0 -375
- package/helpers/fields.d.ts +0 -77
- package/helpers/fields.js +0 -174
- package/helpers/operatorPluginsList.d.ts +0 -7
- package/helpers/operatorPluginsList.js +0 -30
- package/helpers/searchPluginsList.d.ts +0 -6
- package/helpers/transformValueForSearch.d.ts +0 -9
- package/helpers/transformValueForSearch.js +0 -26
- package/operations/entry/elasticsearchFields.d.ts +0 -2
- package/operations/entry/elasticsearchFields.js +0 -32
- package/operations/entry/fields.d.ts +0 -3
- package/operations/entry/fields.js +0 -60
- package/operations/settings/index.d.ts +0 -6
- package/operations/settings/index.js +0 -141
- package/operations/system/createElasticsearchTemplate.d.ts +0 -5
- package/operations/system/createElasticsearchTemplate.js +0 -62
- package/plugins/CmsEntryElasticsearchFieldPlugin.d.ts +0 -12
- package/plugins/CmsEntryElasticsearchFieldPlugin.js +0 -24
- package/upgrades/index.d.ts +0 -2
- package/upgrades/index.js +0 -16
- package/upgrades/utils.d.ts +0 -1
- package/upgrades/utils.js +0 -16
- package/upgrades/v5.0.0/cleanDatabaseRecord.d.ts +0 -6
- package/upgrades/v5.0.0/cleanDatabaseRecord.js +0 -16
- package/upgrades/v5.0.0/createOldVersionIndiceName.d.ts +0 -2
- package/upgrades/v5.0.0/createOldVersionIndiceName.js +0 -12
- package/upgrades/v5.0.0/entryValueFixer.d.ts +0 -4
- package/upgrades/v5.0.0/entryValueFixer.js +0 -124
- package/upgrades/v5.0.0/fieldFinder.d.ts +0 -6
- package/upgrades/v5.0.0/fieldFinder.js +0 -42
- package/upgrades/v5.0.0/helpers.d.ts +0 -4
- package/upgrades/v5.0.0/helpers.js +0 -57
- package/upgrades/v5.0.0/index.d.ts +0 -4
- package/upgrades/v5.0.0/index.js +0 -232
- package/upgrades/v5.8.0/index.d.ts +0 -4
- package/upgrades/v5.8.0/index.js +0 -426
package/definitions/system.js
CHANGED
|
@@ -1,30 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.createSystemEntity = void 0;
|
|
9
|
-
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
|
-
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
13
|
-
|
|
14
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
-
|
|
16
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
17
|
-
|
|
7
|
+
var _toolbox = require("@webiny/db-dynamodb/toolbox");
|
|
18
8
|
const createSystemEntity = params => {
|
|
19
9
|
const {
|
|
20
10
|
entityName,
|
|
21
11
|
attributes,
|
|
22
12
|
table
|
|
23
13
|
} = params;
|
|
24
|
-
return new
|
|
14
|
+
return new _toolbox.Entity({
|
|
25
15
|
name: entityName,
|
|
26
16
|
table,
|
|
27
|
-
attributes:
|
|
17
|
+
attributes: {
|
|
28
18
|
PK: {
|
|
29
19
|
partitionKey: true
|
|
30
20
|
},
|
|
@@ -42,9 +32,11 @@ const createSystemEntity = params => {
|
|
|
42
32
|
},
|
|
43
33
|
readAPIKey: {
|
|
44
34
|
type: "string"
|
|
45
|
-
}
|
|
46
|
-
|
|
35
|
+
},
|
|
36
|
+
...(attributes || {})
|
|
37
|
+
}
|
|
47
38
|
});
|
|
48
39
|
};
|
|
40
|
+
exports.createSystemEntity = createSystemEntity;
|
|
49
41
|
|
|
50
|
-
|
|
42
|
+
//# sourceMappingURL=system.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_toolbox","require","createSystemEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","version","type","locale","tenant","readAPIKey","exports"],"sources":["system.ts"],"sourcesContent":["import type { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport type { Attributes } from \"~/types\";\n\nexport interface CreateSystemEntityParams {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createSystemEntity = (params: CreateSystemEntityParams): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n version: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n readAPIKey: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,kBAAkB,GAAIC,MAAgC,IAAkB;EACjF,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV,CAAC;MACDC,MAAM,EAAE;QACJD,IAAI,EAAE;MACV,CAAC;MACDE,MAAM,EAAE;QACJF,IAAI,EAAE;MACV,CAAC;MACDG,UAAU,EAAE;QACRH,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACa,OAAA,CAAAhB,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
package/definitions/table.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { TableModifier } from "../types";
|
|
2
|
-
import {
|
|
3
|
-
import { Table } from "dynamodb
|
|
4
|
-
export interface
|
|
1
|
+
import type { TableModifier } from "../types";
|
|
2
|
+
import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
|
|
3
|
+
import { Table } from "@webiny/db-dynamodb/toolbox";
|
|
4
|
+
export interface CreateTableParams {
|
|
5
5
|
table?: TableModifier;
|
|
6
|
-
documentClient:
|
|
6
|
+
documentClient: DynamoDBDocument;
|
|
7
7
|
}
|
|
8
|
-
export declare const createTable: ({ table, documentClient }:
|
|
8
|
+
export declare const createTable: ({ table, documentClient }: CreateTableParams) => Table<string, string, string>;
|
package/definitions/table.js
CHANGED
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.createTable = void 0;
|
|
7
|
-
|
|
8
|
-
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
9
|
-
|
|
7
|
+
var _toolbox = require("@webiny/db-dynamodb/toolbox");
|
|
10
8
|
const createTable = ({
|
|
11
9
|
table,
|
|
12
10
|
documentClient
|
|
@@ -15,10 +13,13 @@ const createTable = ({
|
|
|
15
13
|
name: process.env.DB_TABLE_HEADLESS_CMS || process.env.DB_TABLE,
|
|
16
14
|
partitionKey: "PK",
|
|
17
15
|
sortKey: "SK",
|
|
18
|
-
DocumentClient: documentClient
|
|
16
|
+
DocumentClient: documentClient,
|
|
17
|
+
autoExecute: true,
|
|
18
|
+
autoParse: true
|
|
19
19
|
};
|
|
20
20
|
const config = typeof table === "function" ? table(tableConfig) : tableConfig;
|
|
21
|
-
return new
|
|
21
|
+
return new _toolbox.Table(config);
|
|
22
22
|
};
|
|
23
|
+
exports.createTable = createTable;
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
//# sourceMappingURL=table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_toolbox","require","createTable","table","documentClient","tableConfig","name","process","env","DB_TABLE_HEADLESS_CMS","DB_TABLE","partitionKey","sortKey","DocumentClient","autoExecute","autoParse","config","Table","exports"],"sources":["table.ts"],"sourcesContent":["import type { TableModifier } from \"~/types\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb\";\nimport type { TableConstructor } from \"@webiny/db-dynamodb/toolbox\";\nimport { Table } from \"@webiny/db-dynamodb/toolbox\";\n\nexport interface CreateTableParams {\n table?: TableModifier;\n documentClient: DynamoDBDocument;\n}\nexport const createTable = ({\n table,\n documentClient\n}: CreateTableParams): Table<string, string, string> => {\n const tableConfig: TableConstructor<string, string, string> = {\n name: process.env.DB_TABLE_HEADLESS_CMS || (process.env.DB_TABLE as string),\n partitionKey: \"PK\",\n sortKey: \"SK\",\n DocumentClient: documentClient,\n autoExecute: true,\n autoParse: true\n };\n\n const config = typeof table === \"function\" ? table(tableConfig) : tableConfig;\n\n return new Table(config);\n};\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAMO,MAAMC,WAAW,GAAGA,CAAC;EACxBC,KAAK;EACLC;AACe,CAAC,KAAoC;EACpD,MAAMC,WAAqD,GAAG;IAC1DC,IAAI,EAAEC,OAAO,CAACC,GAAG,CAACC,qBAAqB,IAAKF,OAAO,CAACC,GAAG,CAACE,QAAmB;IAC3EC,YAAY,EAAE,IAAI;IAClBC,OAAO,EAAE,IAAI;IACbC,cAAc,EAAET,cAAc;IAC9BU,WAAW,EAAE,IAAI;IACjBC,SAAS,EAAE;EACf,CAAC;EAED,MAAMC,MAAM,GAAG,OAAOb,KAAK,KAAK,UAAU,GAAGA,KAAK,CAACE,WAAW,CAAC,GAAGA,WAAW;EAE7E,OAAO,IAAIY,cAAK,CAACD,MAAM,CAAC;AAC5B,CAAC;AAACE,OAAA,CAAAhB,WAAA,GAAAA,WAAA","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { TableModifier } from "../types";
|
|
2
|
-
import {
|
|
3
|
-
import { Table } from "dynamodb
|
|
4
|
-
export interface
|
|
1
|
+
import type { TableModifier } from "../types";
|
|
2
|
+
import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
|
|
3
|
+
import { Table } from "@webiny/db-dynamodb/toolbox";
|
|
4
|
+
export interface CreateElasticsearchTableParams {
|
|
5
5
|
table?: TableModifier;
|
|
6
|
-
documentClient:
|
|
6
|
+
documentClient: DynamoDBDocument;
|
|
7
7
|
}
|
|
8
|
-
export declare const createElasticsearchTable: ({ table, documentClient }:
|
|
8
|
+
export declare const createElasticsearchTable: ({ table, documentClient }: CreateElasticsearchTableParams) => Table<string, string, string>;
|
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.createElasticsearchTable = void 0;
|
|
7
|
-
|
|
8
|
-
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
9
|
-
|
|
7
|
+
var _toolbox = require("@webiny/db-dynamodb/toolbox");
|
|
10
8
|
const createElasticsearchTable = ({
|
|
11
9
|
table,
|
|
12
10
|
documentClient
|
|
@@ -15,10 +13,13 @@ const createElasticsearchTable = ({
|
|
|
15
13
|
name: process.env.DB_TABLE_ELASTICSEARCH,
|
|
16
14
|
partitionKey: "PK",
|
|
17
15
|
sortKey: "SK",
|
|
18
|
-
DocumentClient: documentClient
|
|
16
|
+
DocumentClient: documentClient,
|
|
17
|
+
autoExecute: true,
|
|
18
|
+
autoParse: true
|
|
19
19
|
};
|
|
20
20
|
const config = typeof table === "function" ? table(tableConfig) : tableConfig;
|
|
21
|
-
return new
|
|
21
|
+
return new _toolbox.Table(config);
|
|
22
22
|
};
|
|
23
|
+
exports.createElasticsearchTable = createElasticsearchTable;
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
//# sourceMappingURL=tableElasticsearch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_toolbox","require","createElasticsearchTable","table","documentClient","tableConfig","name","process","env","DB_TABLE_ELASTICSEARCH","partitionKey","sortKey","DocumentClient","autoExecute","autoParse","config","Table","exports"],"sources":["tableElasticsearch.ts"],"sourcesContent":["import type { TableModifier } from \"~/types\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb\";\nimport { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport type { TableConstructor } from \"@webiny/db-dynamodb/toolbox\";\n\nexport interface CreateElasticsearchTableParams {\n table?: TableModifier;\n documentClient: DynamoDBDocument;\n}\nexport const createElasticsearchTable = ({\n table,\n documentClient\n}: CreateElasticsearchTableParams): Table<string, string, string> => {\n const tableConfig: TableConstructor<string, string, string> = {\n name: process.env.DB_TABLE_ELASTICSEARCH as string,\n partitionKey: \"PK\",\n sortKey: \"SK\",\n DocumentClient: documentClient,\n autoExecute: true,\n autoParse: true\n };\n\n const config = typeof table === \"function\" ? table(tableConfig) : tableConfig;\n\n return new Table(config);\n};\n"],"mappings":";;;;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AAOO,MAAMC,wBAAwB,GAAGA,CAAC;EACrCC,KAAK;EACLC;AAC4B,CAAC,KAAoC;EACjE,MAAMC,WAAqD,GAAG;IAC1DC,IAAI,EAAEC,OAAO,CAACC,GAAG,CAACC,sBAAgC;IAClDC,YAAY,EAAE,IAAI;IAClBC,OAAO,EAAE,IAAI;IACbC,cAAc,EAAER,cAAc;IAC9BS,WAAW,EAAE,IAAI;IACjBC,SAAS,EAAE;EACf,CAAC;EAED,MAAMC,MAAM,GAAG,OAAOZ,KAAK,KAAK,UAAU,GAAGA,KAAK,CAACE,WAAW,CAAC,GAAGA,WAAW;EAE7E,OAAO,IAAIW,cAAK,CAACD,MAAM,CAAC;AAC5B,CAAC;AAACE,OAAA,CAAAf,wBAAA,GAAAA,wBAAA","ignoreList":[]}
|
package/dynamoDb/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
declare const _default: () => import("@webiny/api-headless-cms
|
|
1
|
+
declare const _default: () => import("@webiny/api-headless-cms").StorageTransformPlugin<any, any, import("@webiny/api-headless-cms/types").CmsModelField>[];
|
|
2
2
|
export default _default;
|
|
3
|
+
export declare const createDynamoDbPlugins: () => import("@webiny/api-headless-cms").StorageTransformPlugin<any, any, import("@webiny/api-headless-cms/types").CmsModelField>[];
|
package/dynamoDb/index.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
exports.default = exports.createDynamoDbPlugins = void 0;
|
|
7
|
+
var _richText = require("./storage/richText");
|
|
8
|
+
var _longText = require("./storage/longText");
|
|
9
|
+
var _default = () => createDynamoDbPlugins();
|
|
10
|
+
exports.default = _default;
|
|
11
|
+
const createDynamoDbPlugins = () => {
|
|
12
|
+
return [(0, _richText.createRichTextStorageTransformPlugin)(), (0, _longText.createLongTextStorageTransformPlugin)()];
|
|
13
|
+
};
|
|
14
|
+
exports.createDynamoDbPlugins = createDynamoDbPlugins;
|
|
17
15
|
|
|
18
|
-
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_richText","require","_longText","_default","createDynamoDbPlugins","exports","default","createRichTextStorageTransformPlugin","createLongTextStorageTransformPlugin"],"sources":["index.ts"],"sourcesContent":["import { createRichTextStorageTransformPlugin } from \"./storage/richText\";\nimport { createLongTextStorageTransformPlugin } from \"./storage/longText\";\n\nexport default () => createDynamoDbPlugins();\n\nexport const createDynamoDbPlugins = () => {\n return [createRichTextStorageTransformPlugin(), createLongTextStorageTransformPlugin()];\n};\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAA0E,IAAAE,QAAA,GAE3DA,CAAA,KAAMC,qBAAqB,CAAC,CAAC;AAAAC,OAAA,CAAAC,OAAA,GAAAH,QAAA;AAErC,MAAMC,qBAAqB,GAAGA,CAAA,KAAM;EACvC,OAAO,CAAC,IAAAG,8CAAoC,EAAC,CAAC,EAAE,IAAAC,8CAAoC,EAAC,CAAC,CAAC;AAC3F,CAAC;AAACH,OAAA,CAAAD,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* File is @internal
|
|
3
|
+
*/
|
|
4
|
+
import { StorageTransformPlugin } from "@webiny/api-headless-cms";
|
|
2
5
|
export interface StorageValue {
|
|
3
6
|
compression: string;
|
|
4
|
-
value:
|
|
7
|
+
value: string;
|
|
8
|
+
isArray?: boolean;
|
|
5
9
|
}
|
|
6
|
-
declare const
|
|
7
|
-
export default _default;
|
|
10
|
+
export declare const createLongTextStorageTransformPlugin: () => StorageTransformPlugin<string | string[], StorageValue, import("@webiny/api-headless-cms/types").CmsModelField>;
|
|
@@ -1,83 +1,96 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports.
|
|
9
|
-
|
|
7
|
+
exports.createLongTextStorageTransformPlugin = void 0;
|
|
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");
|
|
11
|
+
/**
|
|
12
|
+
* File is @internal
|
|
13
|
+
*/
|
|
15
14
|
|
|
16
15
|
const GZIP = "gzip";
|
|
17
16
|
const TO_STORAGE_ENCODING = "base64";
|
|
18
17
|
const FROM_STORAGE_ENCODING = "utf8";
|
|
19
|
-
|
|
20
18
|
const convertToBuffer = value => {
|
|
21
19
|
if (typeof value === "string") {
|
|
22
20
|
return Buffer.from(value, TO_STORAGE_ENCODING);
|
|
23
21
|
}
|
|
24
|
-
|
|
25
22
|
return value;
|
|
26
23
|
};
|
|
27
|
-
|
|
28
|
-
const plugin = new
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
24
|
+
const createLongTextStorageTransformPlugin = () => {
|
|
25
|
+
const plugin = new _apiHeadlessCms.StorageTransformPlugin({
|
|
26
|
+
name: "headless-cms.storage-transform.long-text.default",
|
|
27
|
+
fieldType: "long-text",
|
|
28
|
+
fromStorage: async ({
|
|
29
|
+
field,
|
|
30
|
+
value: storageValue
|
|
31
|
+
}) => {
|
|
32
|
+
const typeOf = typeof storageValue;
|
|
33
|
+
if (!storageValue || typeOf === "string" || typeOf === "number" || Array.isArray(storageValue) === true) {
|
|
34
|
+
return storageValue;
|
|
35
|
+
} else if (typeOf !== "object") {
|
|
36
|
+
throw new _error.default(`LongText value received in "fromStorage" function is not an object in field "${field.storageId}" - ${field.fieldId}.`);
|
|
37
|
+
}
|
|
38
|
+
const {
|
|
39
|
+
compression,
|
|
40
|
+
value,
|
|
41
|
+
isArray
|
|
42
|
+
} = storageValue;
|
|
43
|
+
/**
|
|
44
|
+
* Check if possibly undefined, null, empty...
|
|
45
|
+
*/
|
|
46
|
+
if (!compression) {
|
|
47
|
+
throw new _error.default(`Missing compression in "fromStorage" function in field "${field.storageId}" - ${field.fieldId}.": ${JSON.stringify(storageValue)}.`, "MISSING_COMPRESSION", {
|
|
48
|
+
value: storageValue
|
|
49
|
+
});
|
|
50
|
+
} else if (compression !== GZIP) {
|
|
51
|
+
throw new _error.default(`This plugin cannot transform something not compressed with "GZIP".`, "WRONG_COMPRESSION", {
|
|
52
|
+
compression
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
const buf = await (0, _gzip.decompress)(convertToBuffer(value));
|
|
57
|
+
const result = buf.toString(FROM_STORAGE_ENCODING);
|
|
58
|
+
if (!isArray) {
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
return JSON.parse(result);
|
|
62
|
+
} catch (ex) {
|
|
63
|
+
console.log("Error while transforming long-text.");
|
|
64
|
+
console.log(ex.message);
|
|
65
|
+
return "";
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
toStorage: async ({
|
|
69
|
+
value: initialValue
|
|
70
|
+
}) => {
|
|
71
|
+
/**
|
|
72
|
+
* There is a possibility that we are trying to compress already compressed value.
|
|
73
|
+
*/
|
|
74
|
+
if (initialValue && initialValue.hasOwnProperty("compression") === true) {
|
|
75
|
+
return initialValue;
|
|
76
|
+
}
|
|
77
|
+
const isArray = Array.isArray(initialValue);
|
|
78
|
+
const value = isArray ? JSON.stringify(initialValue) : initialValue;
|
|
79
|
+
const compressedValue = await (0, _gzip.compress)(value);
|
|
80
|
+
const result = {
|
|
81
|
+
compression: GZIP,
|
|
82
|
+
value: compressedValue.toString(TO_STORAGE_ENCODING)
|
|
83
|
+
};
|
|
84
|
+
if (!isArray) {
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
result.isArray = isArray;
|
|
88
|
+
return result;
|
|
40
89
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
compression,
|
|
44
|
-
value
|
|
45
|
-
} = storageValue;
|
|
46
|
-
/**
|
|
47
|
-
* Check if possibly undefined, null, empty...
|
|
48
|
-
*/
|
|
49
|
-
|
|
50
|
-
if (!compression) {
|
|
51
|
-
throw new _error.default(`Missing compression in "fromStorage" function in field "${field.fieldId}": ${JSON.stringify(storageValue)}.`, "MISSING_COMPRESSION", {
|
|
52
|
-
value: storageValue
|
|
53
|
-
});
|
|
54
|
-
} else if (compression !== GZIP) {
|
|
55
|
-
throw new _error.default(`This plugin cannot transform something not compressed with "GZIP".`, "WRONG_COMPRESSION", {
|
|
56
|
-
compression
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
const buf = await (0, _gzip.decompress)(convertToBuffer(value));
|
|
62
|
-
return buf.toString(FROM_STORAGE_ENCODING);
|
|
63
|
-
} catch (ex) {
|
|
64
|
-
console.log(ex.message);
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
toStorage: async ({
|
|
69
|
-
value
|
|
70
|
-
}) => {
|
|
71
|
-
const compressedValue = await (0, _gzip.compress)(value);
|
|
72
|
-
return {
|
|
73
|
-
compression: GZIP,
|
|
74
|
-
value: compressedValue.toString(TO_STORAGE_ENCODING)
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
var _default = () => {
|
|
90
|
+
});
|
|
91
|
+
plugin.name = plugin.name = `headless-cms.dynamodb.storageTransform.long-text`;
|
|
80
92
|
return plugin;
|
|
81
93
|
};
|
|
94
|
+
exports.createLongTextStorageTransformPlugin = createLongTextStorageTransformPlugin;
|
|
82
95
|
|
|
83
|
-
|
|
96
|
+
//# sourceMappingURL=longText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_gzip","_apiHeadlessCms","GZIP","TO_STORAGE_ENCODING","FROM_STORAGE_ENCODING","convertToBuffer","value","Buffer","from","createLongTextStorageTransformPlugin","plugin","StorageTransformPlugin","name","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","exports"],"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 name: \"headless-cms.storage-transform.long-text.default\",\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 unknown as StorageValue;\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":"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","ignoreList":[]}
|
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
import { StorageTransformPlugin } from "@webiny/api-headless-cms
|
|
2
|
-
export declare
|
|
3
|
-
export interface StorageValue {
|
|
4
|
-
compression: string;
|
|
5
|
-
value: any;
|
|
6
|
-
}
|
|
7
|
-
declare const _default: () => StorageTransformPlugin<any, any>;
|
|
8
|
-
export default _default;
|
|
1
|
+
import { StorageTransformPlugin } from "@webiny/api-headless-cms";
|
|
2
|
+
export declare const createRichTextStorageTransformPlugin: () => StorageTransformPlugin<any, any, import("@webiny/api-headless-cms/types").CmsModelField>;
|
|
@@ -1,110 +1,59 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports.
|
|
9
|
-
|
|
10
|
-
var _jsonpack = _interopRequireDefault(require("jsonpack"));
|
|
11
|
-
|
|
7
|
+
exports.createRichTextStorageTransformPlugin = void 0;
|
|
12
8
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
13
|
-
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
* Do not remove.
|
|
57
|
-
*/
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (storageValue.hasOwnProperty("compression") === false) {
|
|
61
|
-
return storageValue;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const {
|
|
65
|
-
compression,
|
|
66
|
-
value
|
|
67
|
-
} = storageValue;
|
|
68
|
-
|
|
69
|
-
if (!compression) {
|
|
70
|
-
throw new _error.default(`Missing compression in "fromStorage" function in field "${field.fieldId}": ${JSON.stringify(storageValue)}.`, "MISSING_COMPRESSION", {
|
|
71
|
-
value: storageValue
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (compression !== "jsonpack") {
|
|
76
|
-
throw new _error.default(`This plugin cannot transform something not packed with "jsonpack".`, "WRONG_COMPRESSION", {
|
|
77
|
-
compression
|
|
78
|
-
});
|
|
9
|
+
var _apiHeadlessCms = require("@webiny/api-headless-cms");
|
|
10
|
+
var _api = require("@webiny/api");
|
|
11
|
+
const createRichTextStorageTransformPlugin = () => {
|
|
12
|
+
const plugin = new _apiHeadlessCms.StorageTransformPlugin({
|
|
13
|
+
name: "headless-cms.storage-transform.rich-text.default",
|
|
14
|
+
fieldType: "rich-text",
|
|
15
|
+
fromStorage: async ({
|
|
16
|
+
field,
|
|
17
|
+
value: storageValue,
|
|
18
|
+
plugins
|
|
19
|
+
}) => {
|
|
20
|
+
if (!storageValue) {
|
|
21
|
+
return storageValue;
|
|
22
|
+
} else if (typeof storageValue !== "object") {
|
|
23
|
+
throw new _error.default(`RichText value received in "fromStorage" function is not an object in field "${field.storageId}" - ${field.fieldId}.`);
|
|
24
|
+
}
|
|
25
|
+
let compressor;
|
|
26
|
+
try {
|
|
27
|
+
compressor = plugins.oneByType(_api.CompressorPlugin.type);
|
|
28
|
+
} catch (ex) {
|
|
29
|
+
return storageValue;
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
return await compressor.getCompressor().decompress(storageValue);
|
|
33
|
+
} catch {
|
|
34
|
+
return storageValue;
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
toStorage: async ({
|
|
38
|
+
value,
|
|
39
|
+
plugins
|
|
40
|
+
}) => {
|
|
41
|
+
let compressor;
|
|
42
|
+
try {
|
|
43
|
+
compressor = plugins.oneByType(_api.CompressorPlugin.type);
|
|
44
|
+
} catch (ex) {
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
return await compressor.getCompressor().compress(value);
|
|
49
|
+
} catch {
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
79
52
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return _jsonpack.default.unpack(value);
|
|
83
|
-
} catch {
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
toStorage: async ({
|
|
88
|
-
value
|
|
89
|
-
}) => {
|
|
90
|
-
/**
|
|
91
|
-
* There is a possibility that we are trying to compress already compressed value.
|
|
92
|
-
* Introduced a bug with 5.8.0 storage operations, so just return the value to correct it.
|
|
93
|
-
*/
|
|
94
|
-
if (value && value.hasOwnProperty("compression") === true) {
|
|
95
|
-
return value;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
value = transformArray(value);
|
|
99
|
-
return {
|
|
100
|
-
compression: "jsonpack",
|
|
101
|
-
value: value ? _jsonpack.default.pack(value) : value
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
var _default = () => {
|
|
53
|
+
});
|
|
54
|
+
plugin.name = `headless-cms.dynamodb.storageTransform.rich-text`;
|
|
107
55
|
return plugin;
|
|
108
56
|
};
|
|
57
|
+
exports.createRichTextStorageTransformPlugin = createRichTextStorageTransformPlugin;
|
|
109
58
|
|
|
110
|
-
|
|
59
|
+
//# sourceMappingURL=richText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_apiHeadlessCms","_api","createRichTextStorageTransformPlugin","plugin","StorageTransformPlugin","name","fieldType","fromStorage","field","value","storageValue","plugins","WebinyError","storageId","fieldId","compressor","oneByType","CompressorPlugin","type","ex","getCompressor","decompress","toStorage","compress","exports"],"sources":["richText.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { StorageTransformPlugin } from \"@webiny/api-headless-cms\";\nimport { CompressorPlugin } from \"@webiny/api\";\n\nexport const createRichTextStorageTransformPlugin = () => {\n const plugin = new StorageTransformPlugin({\n name: \"headless-cms.storage-transform.rich-text.default\",\n fieldType: \"rich-text\",\n fromStorage: async ({ field, value: storageValue, plugins }) => {\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}\" - ${field.fieldId}.`\n );\n }\n\n let compressor: CompressorPlugin;\n\n try {\n compressor = plugins.oneByType<CompressorPlugin>(CompressorPlugin.type);\n } catch (ex) {\n return storageValue;\n }\n\n try {\n return await compressor.getCompressor().decompress(storageValue);\n } catch {\n return storageValue;\n }\n },\n toStorage: async ({ value, plugins }) => {\n let compressor: CompressorPlugin;\n\n try {\n compressor = plugins.oneByType<CompressorPlugin>(CompressorPlugin.type);\n } catch (ex) {\n return value;\n }\n try {\n return await compressor.getCompressor().compress(value);\n } catch {\n return value;\n }\n }\n });\n plugin.name = `headless-cms.dynamodb.storageTransform.rich-text`;\n\n return plugin;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AAEO,MAAMG,oCAAoC,GAAGA,CAAA,KAAM;EACtD,MAAMC,MAAM,GAAG,IAAIC,sCAAsB,CAAC;IACtCC,IAAI,EAAE,kDAAkD;IACxDC,SAAS,EAAE,WAAW;IACtBC,WAAW,EAAE,MAAAA,CAAO;MAAEC,KAAK;MAAEC,KAAK,EAAEC,YAAY;MAAEC;IAAQ,CAAC,KAAK;MAC5D,IAAI,CAACD,YAAY,EAAE;QACf,OAAOA,YAAY;MACvB,CAAC,MAAM,IAAI,OAAOA,YAAY,KAAK,QAAQ,EAAE;QACzC,MAAM,IAAIE,cAAW,CACjB,gFAAgFJ,KAAK,CAACK,SAAS,OAAOL,KAAK,CAACM,OAAO,GACvH,CAAC;MACL;MAEA,IAAIC,UAA4B;MAEhC,IAAI;QACAA,UAAU,GAAGJ,OAAO,CAACK,SAAS,CAAmBC,qBAAgB,CAACC,IAAI,CAAC;MAC3E,CAAC,CAAC,OAAOC,EAAE,EAAE;QACT,OAAOT,YAAY;MACvB;MAEA,IAAI;QACA,OAAO,MAAMK,UAAU,CAACK,aAAa,CAAC,CAAC,CAACC,UAAU,CAACX,YAAY,CAAC;MACpE,CAAC,CAAC,MAAM;QACJ,OAAOA,YAAY;MACvB;IACJ,CAAC;IACDY,SAAS,EAAE,MAAAA,CAAO;MAAEb,KAAK;MAAEE;IAAQ,CAAC,KAAK;MACrC,IAAII,UAA4B;MAEhC,IAAI;QACAA,UAAU,GAAGJ,OAAO,CAACK,SAAS,CAAmBC,qBAAgB,CAACC,IAAI,CAAC;MAC3E,CAAC,CAAC,OAAOC,EAAE,EAAE;QACT,OAAOV,KAAK;MAChB;MACA,IAAI;QACA,OAAO,MAAMM,UAAU,CAACK,aAAa,CAAC,CAAC,CAACG,QAAQ,CAACd,KAAK,CAAC;MAC3D,CAAC,CAAC,MAAM;QACJ,OAAOA,KAAK;MAChB;IACJ;EACJ,CAAC,CAAC;EACFN,MAAM,CAACE,IAAI,GAAG,kDAAkD;EAEhE,OAAOF,MAAM;AACjB,CAAC;AAACqB,OAAA,CAAAtB,oCAAA,GAAAA,oCAAA","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Client } from "@elastic/elasticsearch";
|
|
2
|
+
import type { PluginsContainer } from "@webiny/plugins";
|
|
3
|
+
import type { CmsModel } from "@webiny/api-headless-cms/types";
|
|
4
|
+
export interface CreateElasticsearchIndexParams {
|
|
5
|
+
client: Client;
|
|
6
|
+
plugins: PluginsContainer;
|
|
7
|
+
model: CmsModel;
|
|
8
|
+
}
|
|
9
|
+
export declare const createElasticsearchIndex: (params: CreateElasticsearchIndexParams) => Promise<void>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createElasticsearchIndex = void 0;
|
|
7
|
+
var _CmsEntryElasticsearchIndexPlugin = require("../plugins/CmsEntryElasticsearchIndexPlugin");
|
|
8
|
+
var _apiElasticsearch = require("@webiny/api-elasticsearch");
|
|
9
|
+
var _configurations = require("../configurations");
|
|
10
|
+
const createElasticsearchIndex = async params => {
|
|
11
|
+
const {
|
|
12
|
+
client,
|
|
13
|
+
plugins,
|
|
14
|
+
model
|
|
15
|
+
} = params;
|
|
16
|
+
const {
|
|
17
|
+
index
|
|
18
|
+
} = _configurations.configurations.es({
|
|
19
|
+
model
|
|
20
|
+
});
|
|
21
|
+
await (0, _apiElasticsearch.createIndex)({
|
|
22
|
+
client,
|
|
23
|
+
index,
|
|
24
|
+
type: _CmsEntryElasticsearchIndexPlugin.CmsEntryElasticsearchIndexPlugin.type,
|
|
25
|
+
tenant: model.tenant,
|
|
26
|
+
locale: model.locale,
|
|
27
|
+
plugins,
|
|
28
|
+
onExists: () => {
|
|
29
|
+
console.log(`Elasticsearch index "${index}" for the CMS model "${model.name}" already exists.`);
|
|
30
|
+
},
|
|
31
|
+
onError: ex => {
|
|
32
|
+
console.error(`Could not create Elasticsearch index "${index}" for the CMS model "${model.name}".`);
|
|
33
|
+
console.error(ex);
|
|
34
|
+
return ex;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
exports.createElasticsearchIndex = createElasticsearchIndex;
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=createElasticsearchIndex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_CmsEntryElasticsearchIndexPlugin","require","_apiElasticsearch","_configurations","createElasticsearchIndex","params","client","plugins","model","index","configurations","es","createIndex","type","CmsEntryElasticsearchIndexPlugin","tenant","locale","onExists","console","log","name","onError","ex","error","exports"],"sources":["createElasticsearchIndex.ts"],"sourcesContent":["import type { Client } from \"@elastic/elasticsearch\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport { CmsEntryElasticsearchIndexPlugin } from \"~/plugins/CmsEntryElasticsearchIndexPlugin\";\nimport { createIndex } from \"@webiny/api-elasticsearch\";\nimport { configurations } from \"~/configurations\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types\";\n\nexport interface CreateElasticsearchIndexParams {\n client: Client;\n plugins: PluginsContainer;\n model: CmsModel;\n}\n\nexport const createElasticsearchIndex = async (params: CreateElasticsearchIndexParams) => {\n const { client, plugins, model } = params;\n\n const { index } = configurations.es({\n model\n });\n\n await createIndex({\n client,\n index,\n type: CmsEntryElasticsearchIndexPlugin.type,\n tenant: model.tenant,\n locale: model.locale,\n plugins,\n onExists: () => {\n console.log(\n `Elasticsearch index \"${index}\" for the CMS model \"${model.name}\" already exists.`\n );\n },\n onError: ex => {\n console.error(\n `Could not create Elasticsearch index \"${index}\" for the CMS model \"${model.name}\".`\n );\n console.error(ex);\n return ex;\n }\n });\n};\n"],"mappings":";;;;;;AAEA,IAAAA,iCAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AASO,MAAMG,wBAAwB,GAAG,MAAOC,MAAsC,IAAK;EACtF,MAAM;IAAEC,MAAM;IAAEC,OAAO;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAEzC,MAAM;IAAEI;EAAM,CAAC,GAAGC,8BAAc,CAACC,EAAE,CAAC;IAChCH;EACJ,CAAC,CAAC;EAEF,MAAM,IAAAI,6BAAW,EAAC;IACdN,MAAM;IACNG,KAAK;IACLI,IAAI,EAAEC,kEAAgC,CAACD,IAAI;IAC3CE,MAAM,EAAEP,KAAK,CAACO,MAAM;IACpBC,MAAM,EAAER,KAAK,CAACQ,MAAM;IACpBT,OAAO;IACPU,QAAQ,EAAEA,CAAA,KAAM;MACZC,OAAO,CAACC,GAAG,CACP,wBAAwBV,KAAK,wBAAwBD,KAAK,CAACY,IAAI,mBACnE,CAAC;IACL,CAAC;IACDC,OAAO,EAAEC,EAAE,IAAI;MACXJ,OAAO,CAACK,KAAK,CACT,yCAAyCd,KAAK,wBAAwBD,KAAK,CAACY,IAAI,IACpF,CAAC;MACDF,OAAO,CAACK,KAAK,CAACD,EAAE,CAAC;MACjB,OAAOA,EAAE;IACb;EACJ,CAAC,CAAC;AACN,CAAC;AAACE,OAAA,CAAApB,wBAAA,GAAAA,wBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Client } from "@elastic/elasticsearch";
|
|
2
|
+
import type { CmsModel } from "@webiny/api-headless-cms/types";
|
|
3
|
+
interface DeleteElasticsearchIndexParams {
|
|
4
|
+
client: Client;
|
|
5
|
+
model: CmsModel;
|
|
6
|
+
}
|
|
7
|
+
export declare const deleteElasticsearchIndex: (params: DeleteElasticsearchIndexParams) => Promise<void>;
|
|
8
|
+
export {};
|