@webiny/api-headless-cms-ddb-es 6.0.0-beta.0 → 6.0.0-rc.0
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/README.md +6 -30
- package/configurations.d.ts +4 -5
- package/configurations.js +12 -24
- package/configurations.js.map +1 -1
- package/definitions/entry.d.ts +4 -5
- package/definitions/entry.js +5 -174
- package/definitions/entry.js.map +1 -1
- package/definitions/group.d.ts +6 -6
- package/definitions/group.js +5 -58
- package/definitions/group.js.map +1 -1
- package/definitions/model.d.ts +6 -6
- package/definitions/model.js +5 -102
- package/definitions/model.js.map +1 -1
- package/definitions/types.d.ts +59 -0
- package/definitions/types.js +3 -0
- package/definitions/types.js.map +1 -0
- package/dynamoDb/index.d.ts +2 -2
- package/dynamoDb/index.js +5 -14
- package/dynamoDb/index.js.map +1 -1
- package/dynamoDb/storage/longText.js +11 -18
- package/dynamoDb/storage/longText.js.map +1 -1
- package/dynamoDb/storage/richText.d.ts +0 -5
- package/dynamoDb/storage/richText.js +25 -80
- package/dynamoDb/storage/richText.js.map +1 -1
- package/elasticsearch/createElasticsearchIndex.d.ts +3 -3
- package/elasticsearch/createElasticsearchIndex.js +7 -15
- package/elasticsearch/createElasticsearchIndex.js.map +1 -1
- package/elasticsearch/deleteElasticsearchIndex.d.ts +2 -2
- package/elasticsearch/deleteElasticsearchIndex.js +3 -10
- package/elasticsearch/deleteElasticsearchIndex.js.map +1 -1
- package/elasticsearch/index.d.ts +1 -1
- package/elasticsearch/index.js +3 -11
- package/elasticsearch/index.js.map +1 -1
- package/elasticsearch/indexing/dateTimeIndexing.d.ts +1 -1
- package/elasticsearch/indexing/dateTimeIndexing.js +1 -8
- package/elasticsearch/indexing/dateTimeIndexing.js.map +1 -1
- package/elasticsearch/indexing/defaultFieldIndexing.d.ts +1 -1
- package/elasticsearch/indexing/defaultFieldIndexing.js +1 -8
- package/elasticsearch/indexing/defaultFieldIndexing.js.map +1 -1
- package/elasticsearch/indexing/index.d.ts +1 -1
- package/elasticsearch/indexing/index.js +8 -16
- package/elasticsearch/indexing/index.js.map +1 -1
- package/elasticsearch/indexing/jsonIndexing.d.ts +1 -1
- package/elasticsearch/indexing/jsonIndexing.js +1 -8
- package/elasticsearch/indexing/jsonIndexing.js.map +1 -1
- package/elasticsearch/indexing/longTextIndexing.d.ts +1 -1
- package/elasticsearch/indexing/longTextIndexing.js +1 -8
- package/elasticsearch/indexing/longTextIndexing.js.map +1 -1
- package/elasticsearch/indexing/numberIndexing.d.ts +1 -1
- package/elasticsearch/indexing/numberIndexing.js +1 -8
- package/elasticsearch/indexing/numberIndexing.js.map +1 -1
- package/elasticsearch/indexing/objectIndexing.d.ts +1 -1
- package/elasticsearch/indexing/objectIndexing.js +6 -13
- package/elasticsearch/indexing/objectIndexing.js.map +1 -1
- package/elasticsearch/indexing/richTextIndexing.d.ts +1 -1
- package/elasticsearch/indexing/richTextIndexing.js +1 -8
- package/elasticsearch/indexing/richTextIndexing.js.map +1 -1
- package/elasticsearch/indices/base.d.ts +1 -1
- package/elasticsearch/indices/base.js +4 -10
- package/elasticsearch/indices/base.js.map +1 -1
- package/elasticsearch/indices/index.d.ts +1 -1
- package/elasticsearch/indices/index.js +3 -11
- package/elasticsearch/indices/index.js.map +1 -1
- package/elasticsearch/search/index.d.ts +1 -1
- package/elasticsearch/search/index.js +4 -10
- package/elasticsearch/search/index.js.map +1 -1
- package/elasticsearch/search/refSearch.d.ts +1 -1
- package/elasticsearch/search/refSearch.js +3 -10
- package/elasticsearch/search/refSearch.js.map +1 -1
- package/elasticsearch/search/searchableJson.d.ts +2 -0
- package/elasticsearch/search/searchableJson.js +53 -0
- package/elasticsearch/search/searchableJson.js.map +1 -0
- package/elasticsearch/search/timeSearch.d.ts +1 -1
- package/elasticsearch/search/timeSearch.js +3 -10
- package/elasticsearch/search/timeSearch.js.map +1 -1
- package/helpers/entryIndexHelpers.d.ts +10 -10
- package/helpers/entryIndexHelpers.js +32 -26
- package/helpers/entryIndexHelpers.js.map +1 -1
- package/helpers/fieldIdentifier.d.ts +1 -1
- package/helpers/fieldIdentifier.js +2 -10
- package/helpers/fieldIdentifier.js.map +1 -1
- package/helpers/index.d.ts +2 -2
- package/helpers/index.js +2 -27
- package/helpers/index.js.map +1 -1
- package/index.d.ts +2 -2
- package/index.js +108 -134
- package/index.js.map +1 -1
- package/operations/entry/dataLoader/DataLoaderCache.d.ts +1 -3
- package/operations/entry/dataLoader/DataLoaderCache.js +2 -9
- package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
- package/operations/entry/dataLoader/constants.js +1 -7
- package/operations/entry/dataLoader/constants.js.map +1 -1
- package/operations/entry/dataLoader/createBatchScheduleFn.js +4 -10
- package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
- package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +3 -3
- package/operations/entry/dataLoader/getAllEntryRevisions.js +11 -24
- package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +3 -3
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +18 -30
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +3 -3
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +18 -30
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
- package/operations/entry/dataLoader/getRevisionById.d.ts +3 -3
- package/operations/entry/dataLoader/getRevisionById.js +23 -35
- package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
- package/operations/entry/dataLoader/index.d.ts +5 -5
- package/operations/entry/dataLoader/index.js +10 -31
- package/operations/entry/dataLoader/index.js.map +1 -1
- package/operations/entry/dataLoader/types.d.ts +3 -4
- package/operations/entry/dataLoader/types.js +1 -5
- package/operations/entry/dataLoader/types.js.map +1 -1
- package/operations/entry/dataLoaders.d.ts +13 -13
- package/operations/entry/dataLoaders.js +15 -25
- package/operations/entry/dataLoaders.js.map +1 -1
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +1 -1
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +1 -8
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +1 -1
- package/operations/entry/elasticsearch/body.d.ts +3 -3
- package/operations/entry/elasticsearch/body.js +21 -28
- package/operations/entry/elasticsearch/body.js.map +1 -1
- package/operations/entry/elasticsearch/fields.d.ts +3 -3
- package/operations/entry/elasticsearch/fields.js +110 -24
- package/operations/entry/elasticsearch/fields.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +2 -2
- package/operations/entry/elasticsearch/filtering/applyFiltering.js +10 -17
- package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/exec.d.ts +7 -6
- package/operations/entry/elasticsearch/filtering/exec.js +48 -45
- package/operations/entry/elasticsearch/filtering/exec.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/index.d.ts +1 -1
- package/operations/entry/elasticsearch/filtering/index.js +1 -16
- package/operations/entry/elasticsearch/filtering/index.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/path.d.ts +2 -1
- package/operations/entry/elasticsearch/filtering/path.js +9 -17
- package/operations/entry/elasticsearch/filtering/path.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.d.ts +1 -1
- package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +6 -14
- package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/plugins/index.d.ts +1 -1
- package/operations/entry/elasticsearch/filtering/plugins/index.js +5 -12
- package/operations/entry/elasticsearch/filtering/plugins/index.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.d.ts +1 -1
- package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +7 -15
- package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.d.ts +1 -1
- package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +15 -16
- package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/populated.d.ts +1 -1
- package/operations/entry/elasticsearch/filtering/populated.js +1 -8
- package/operations/entry/elasticsearch/filtering/populated.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/values.d.ts +1 -1
- package/operations/entry/elasticsearch/filtering/values.js +4 -12
- package/operations/entry/elasticsearch/filtering/values.js.map +1 -1
- package/operations/entry/elasticsearch/fullTextSearch.d.ts +3 -3
- package/operations/entry/elasticsearch/fullTextSearch.js +6 -12
- package/operations/entry/elasticsearch/fullTextSearch.js.map +1 -1
- package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +1 -1
- package/operations/entry/elasticsearch/fullTextSearchFields.js +1 -8
- package/operations/entry/elasticsearch/fullTextSearchFields.js.map +1 -1
- package/operations/entry/elasticsearch/initialQuery.d.ts +2 -2
- package/operations/entry/elasticsearch/initialQuery.js +9 -26
- package/operations/entry/elasticsearch/initialQuery.js.map +1 -1
- package/operations/entry/elasticsearch/keyword.d.ts +1 -1
- package/operations/entry/elasticsearch/keyword.js +4 -9
- package/operations/entry/elasticsearch/keyword.js.map +1 -1
- package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +4 -4
- package/operations/entry/elasticsearch/plugins/bodyModifier.js +3 -10
- package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +1 -1
- package/operations/entry/elasticsearch/plugins/operator.d.ts +2 -3
- package/operations/entry/elasticsearch/plugins/operator.js +4 -19
- package/operations/entry/elasticsearch/plugins/operator.js.map +1 -1
- package/operations/entry/elasticsearch/plugins/queryModifier.d.ts +4 -4
- package/operations/entry/elasticsearch/plugins/queryModifier.js +3 -10
- package/operations/entry/elasticsearch/plugins/queryModifier.js.map +1 -1
- package/operations/entry/elasticsearch/plugins/search.d.ts +2 -2
- package/operations/entry/elasticsearch/plugins/search.js +5 -13
- package/operations/entry/elasticsearch/plugins/search.js.map +1 -1
- package/operations/entry/elasticsearch/plugins/sortModifier.d.ts +4 -4
- package/operations/entry/elasticsearch/plugins/sortModifier.js +3 -10
- package/operations/entry/elasticsearch/plugins/sortModifier.js.map +1 -1
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.d.ts +2 -0
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +6 -0
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js.map +1 -0
- package/operations/entry/elasticsearch/sort.d.ts +4 -4
- package/operations/entry/elasticsearch/sort.js +57 -33
- package/operations/entry/elasticsearch/sort.js.map +1 -1
- package/operations/entry/elasticsearch/transformValueForSearch.d.ts +2 -2
- package/operations/entry/elasticsearch/transformValueForSearch.js +4 -9
- package/operations/entry/elasticsearch/transformValueForSearch.js.map +1 -1
- package/operations/entry/elasticsearch/types.d.ts +5 -5
- package/operations/entry/elasticsearch/types.js +1 -5
- package/operations/entry/elasticsearch/types.js.map +1 -1
- package/operations/entry/index.d.ts +7 -6
- package/operations/entry/index.js +634 -735
- package/operations/entry/index.js.map +1 -1
- package/operations/entry/keys.d.ts +31 -1
- package/operations/entry/keys.js +56 -19
- package/operations/entry/keys.js.map +1 -1
- package/operations/entry/recordType.js +3 -12
- package/operations/entry/recordType.js.map +1 -1
- package/operations/entry/transformations/convertEntryKeys.d.ts +6 -6
- package/operations/entry/transformations/convertEntryKeys.js +2 -10
- package/operations/entry/transformations/convertEntryKeys.js.map +1 -1
- package/operations/entry/transformations/index.d.ts +17 -17
- package/operations/entry/transformations/index.js +22 -30
- package/operations/entry/transformations/index.js.map +1 -1
- package/operations/entry/transformations/modifyEntryValues.d.ts +27 -34
- package/operations/entry/transformations/modifyEntryValues.js +1 -8
- package/operations/entry/transformations/modifyEntryValues.js.map +1 -1
- package/operations/entry/transformations/transformEntryKeys.d.ts +8 -8
- package/operations/entry/transformations/transformEntryKeys.js +4 -11
- package/operations/entry/transformations/transformEntryKeys.js.map +1 -1
- package/operations/entry/transformations/transformEntryToIndex.d.ts +7 -7
- package/operations/entry/transformations/transformEntryToIndex.js +3 -10
- package/operations/entry/transformations/transformEntryToIndex.js.map +1 -1
- package/operations/group/index.d.ts +6 -5
- package/operations/group/index.js +39 -73
- package/operations/group/index.js.map +1 -1
- package/operations/model/index.d.ts +4 -4
- package/operations/model/index.js +38 -57
- package/operations/model/index.js.map +1 -1
- package/package.json +29 -41
- package/plugins/CmsElasticsearchModelFieldPlugin.d.ts +1 -1
- package/plugins/CmsElasticsearchModelFieldPlugin.js +2 -8
- package/plugins/CmsElasticsearchModelFieldPlugin.js.map +1 -1
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +3 -2
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +3 -11
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +1 -1
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.d.ts +2 -2
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +3 -11
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js.map +1 -1
- package/plugins/CmsEntryElasticsearchIndexPlugin.js +2 -9
- package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +1 -1
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +3 -2
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +3 -11
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +1 -1
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +3 -2
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +3 -11
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +1 -1
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +3 -2
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +3 -11
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +1 -1
- package/plugins/CmsEntryElasticsearchValuesModifier.d.ts +12 -12
- package/plugins/CmsEntryElasticsearchValuesModifier.js +4 -12
- package/plugins/CmsEntryElasticsearchValuesModifier.js.map +1 -1
- package/plugins/CmsEntryFilterPlugin.d.ts +3 -3
- package/plugins/CmsEntryFilterPlugin.js +2 -9
- package/plugins/CmsEntryFilterPlugin.js.map +1 -1
- package/plugins/index.d.ts +8 -8
- package/plugins/index.js +8 -93
- package/plugins/index.js.map +1 -1
- package/tasks/createIndexTaskPlugin.d.ts +2 -2
- package/tasks/createIndexTaskPlugin.js +36 -62
- package/tasks/createIndexTaskPlugin.js.map +1 -1
- package/types.d.ts +28 -33
- package/types.js +5 -8
- package/types.js.map +1 -1
- package/values/NoValueContainer.d.ts +5 -0
- package/values/NoValueContainer.js +13 -0
- package/values/NoValueContainer.js.map +1 -0
- package/definitions/entryElasticsearch.d.ts +0 -8
- package/definitions/entryElasticsearch.js +0 -38
- package/definitions/entryElasticsearch.js.map +0 -1
- package/definitions/system.d.ts +0 -8
- package/definitions/system.js +0 -42
- package/definitions/system.js.map +0 -1
- package/definitions/table.d.ts +0 -8
- package/definitions/table.js +0 -25
- package/definitions/table.js.map +0 -1
- package/definitions/tableElasticsearch.d.ts +0 -8
- package/definitions/tableElasticsearch.js +0 -25
- package/definitions/tableElasticsearch.js.map +0 -1
- package/dynamoDb/storage/date.d.ts +0 -3
- package/dynamoDb/storage/date.js +0 -84
- package/dynamoDb/storage/date.js.map +0 -1
- package/elasticsearch/indices/japanese.d.ts +0 -2
- package/elasticsearch/indices/japanese.js +0 -14
- package/elasticsearch/indices/japanese.js.map +0 -1
- package/operations/system/index.d.ts +0 -6
- package/operations/system/index.js +0 -94
- package/operations/system/index.js.map +0 -1
- package/operations/system/indexes.d.ts +0 -10
- package/operations/system/indexes.js +0 -41
- package/operations/system/indexes.js.map +0 -1
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createElasticsearchTable = void 0;
|
|
7
|
-
var _toolbox = require("@webiny/db-dynamodb/toolbox");
|
|
8
|
-
const createElasticsearchTable = ({
|
|
9
|
-
table,
|
|
10
|
-
documentClient
|
|
11
|
-
}) => {
|
|
12
|
-
const tableConfig = {
|
|
13
|
-
name: process.env.DB_TABLE_ELASTICSEARCH,
|
|
14
|
-
partitionKey: "PK",
|
|
15
|
-
sortKey: "SK",
|
|
16
|
-
DocumentClient: documentClient,
|
|
17
|
-
autoExecute: true,
|
|
18
|
-
autoParse: true
|
|
19
|
-
};
|
|
20
|
-
const config = typeof table === "function" ? table(tableConfig) : tableConfig;
|
|
21
|
-
return new _toolbox.Table(config);
|
|
22
|
-
};
|
|
23
|
-
exports.createElasticsearchTable = createElasticsearchTable;
|
|
24
|
-
|
|
25
|
-
//# sourceMappingURL=tableElasticsearch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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 { TableModifier } from \"~/types\";\nimport { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb\";\nimport { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { 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/storage/date.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.createDateStorageTransformPlugin = void 0;
|
|
8
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
-
var _apiHeadlessCms = require("@webiny/api-headless-cms");
|
|
10
|
-
/**
|
|
11
|
-
* File is @internal
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
const excludeTypes = ["time", "dateTimeWithTimezone"];
|
|
15
|
-
const convertFromStorage = (field, value) => {
|
|
16
|
-
try {
|
|
17
|
-
if (field.multipleValues) {
|
|
18
|
-
return (value || []).filter(v => !!v).map(v => {
|
|
19
|
-
return new Date(v);
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
return new Date(value);
|
|
23
|
-
} catch {
|
|
24
|
-
console.log(`Could not transform from storage for field type`);
|
|
25
|
-
return value;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
const convertValueToStorage = (field, value) => {
|
|
29
|
-
if (typeof value === "string") {
|
|
30
|
-
return value;
|
|
31
|
-
} else if (value instanceof Date || value.toISOString) {
|
|
32
|
-
return value.toISOString();
|
|
33
|
-
} else {
|
|
34
|
-
throw new _error.default("Error converting value to a storage type.", "TO_STORAGE_ERROR", {
|
|
35
|
-
value: value,
|
|
36
|
-
fieldId: field.fieldId,
|
|
37
|
-
storageId: field.storageId
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
const createDateStorageTransformPlugin = () => {
|
|
42
|
-
const plugin = new _apiHeadlessCms.StorageTransformPlugin({
|
|
43
|
-
fieldType: "datetime",
|
|
44
|
-
fromStorage: async ({
|
|
45
|
-
value,
|
|
46
|
-
field
|
|
47
|
-
}) => {
|
|
48
|
-
const {
|
|
49
|
-
type
|
|
50
|
-
} = field.settings || {};
|
|
51
|
-
if (!value || !type || excludeTypes.includes(type)) {
|
|
52
|
-
return value;
|
|
53
|
-
}
|
|
54
|
-
return convertFromStorage(field, value);
|
|
55
|
-
},
|
|
56
|
-
toStorage: async ({
|
|
57
|
-
value,
|
|
58
|
-
field
|
|
59
|
-
}) => {
|
|
60
|
-
const {
|
|
61
|
-
type
|
|
62
|
-
} = field.settings || {};
|
|
63
|
-
if (!value || !type || excludeTypes.includes(type)) {
|
|
64
|
-
return value;
|
|
65
|
-
}
|
|
66
|
-
if (field.multipleValues) {
|
|
67
|
-
const multipleValues = value;
|
|
68
|
-
return (multipleValues || []).reduce((result, value) => {
|
|
69
|
-
if (!value) {
|
|
70
|
-
return result;
|
|
71
|
-
}
|
|
72
|
-
result.push(convertValueToStorage(field, value));
|
|
73
|
-
return result;
|
|
74
|
-
}, []);
|
|
75
|
-
}
|
|
76
|
-
return convertValueToStorage(field, value);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
plugin.name = `headless-cms.dynamodb.storageTransform.date`;
|
|
80
|
-
return plugin;
|
|
81
|
-
};
|
|
82
|
-
exports.createDateStorageTransformPlugin = createDateStorageTransformPlugin;
|
|
83
|
-
|
|
84
|
-
//# sourceMappingURL=date.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","_apiHeadlessCms","excludeTypes","convertFromStorage","field","value","multipleValues","filter","v","map","Date","console","log","convertValueToStorage","toISOString","WebinyError","fieldId","storageId","createDateStorageTransformPlugin","plugin","StorageTransformPlugin","fieldType","fromStorage","type","settings","includes","toStorage","reduce","result","push","name","exports"],"sources":["date.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport WebinyError from \"@webiny/error\";\nimport { StorageTransformPlugin } from \"@webiny/api-headless-cms\";\nimport { CmsModelField } from \"@webiny/api-headless-cms/types\";\n\ntype PartialCmsModelField = Pick<CmsModelField, \"fieldId\" | \"storageId\" | \"multipleValues\">;\n\nconst excludeTypes = [\"time\", \"dateTimeWithTimezone\"];\n\nconst convertFromStorage = (field: PartialCmsModelField, value: string | string[]) => {\n try {\n if (field.multipleValues) {\n return ((value as string[]) || [])\n .filter(v => !!v)\n .map((v: string) => {\n return new Date(v);\n });\n }\n return new Date(value as string);\n } catch {\n console.log(`Could not transform from storage for field type`);\n return value;\n }\n};\n\nconst convertValueToStorage = (\n field: PartialCmsModelField,\n value: Date | Record<string, any> | string\n): string => {\n if (typeof value === \"string\") {\n return value as string;\n } else if (value instanceof Date || value.toISOString) {\n return (value as Date).toISOString();\n } else {\n throw new WebinyError(\"Error converting value to a storage type.\", \"TO_STORAGE_ERROR\", {\n value: value,\n fieldId: field.fieldId,\n storageId: field.storageId\n });\n }\n};\n\nexport const createDateStorageTransformPlugin = () => {\n const plugin = new StorageTransformPlugin({\n fieldType: \"datetime\",\n fromStorage: async ({ value, field }) => {\n const { type } = field.settings || {};\n if (!value || !type || excludeTypes.includes(type)) {\n return value;\n }\n return convertFromStorage(field, value);\n },\n toStorage: async ({ value, field }) => {\n const { type } = field.settings || {};\n if (!value || !type || excludeTypes.includes(type)) {\n return value;\n }\n if (field.multipleValues) {\n const multipleValues = value as (string | Date | null | undefined)[];\n\n return (multipleValues || []).reduce<string[]>((result, value) => {\n if (!value) {\n return result;\n }\n result.push(convertValueToStorage(field, value));\n return result;\n }, []);\n }\n return convertValueToStorage(field, value);\n }\n });\n plugin.name = `headless-cms.dynamodb.storageTransform.date`;\n\n return plugin;\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAOA,MAAME,YAAY,GAAG,CAAC,MAAM,EAAE,sBAAsB,CAAC;AAErD,MAAMC,kBAAkB,GAAGA,CAACC,KAA2B,EAAEC,KAAwB,KAAK;EAClF,IAAI;IACA,IAAID,KAAK,CAACE,cAAc,EAAE;MACtB,OAAO,CAAED,KAAK,IAAiB,EAAE,EAC5BE,MAAM,CAACC,CAAC,IAAI,CAAC,CAACA,CAAC,CAAC,CAChBC,GAAG,CAAED,CAAS,IAAK;QAChB,OAAO,IAAIE,IAAI,CAACF,CAAC,CAAC;MACtB,CAAC,CAAC;IACV;IACA,OAAO,IAAIE,IAAI,CAACL,KAAe,CAAC;EACpC,CAAC,CAAC,MAAM;IACJM,OAAO,CAACC,GAAG,CAAE,iDAAgD,CAAC;IAC9D,OAAOP,KAAK;EAChB;AACJ,CAAC;AAED,MAAMQ,qBAAqB,GAAGA,CAC1BT,KAA2B,EAC3BC,KAA0C,KACjC;EACT,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC3B,OAAOA,KAAK;EAChB,CAAC,MAAM,IAAIA,KAAK,YAAYK,IAAI,IAAIL,KAAK,CAACS,WAAW,EAAE;IACnD,OAAQT,KAAK,CAAUS,WAAW,CAAC,CAAC;EACxC,CAAC,MAAM;IACH,MAAM,IAAIC,cAAW,CAAC,2CAA2C,EAAE,kBAAkB,EAAE;MACnFV,KAAK,EAAEA,KAAK;MACZW,OAAO,EAAEZ,KAAK,CAACY,OAAO;MACtBC,SAAS,EAAEb,KAAK,CAACa;IACrB,CAAC,CAAC;EACN;AACJ,CAAC;AAEM,MAAMC,gCAAgC,GAAGA,CAAA,KAAM;EAClD,MAAMC,MAAM,GAAG,IAAIC,sCAAsB,CAAC;IACtCC,SAAS,EAAE,UAAU;IACrBC,WAAW,EAAE,MAAAA,CAAO;MAAEjB,KAAK;MAAED;IAAM,CAAC,KAAK;MACrC,MAAM;QAAEmB;MAAK,CAAC,GAAGnB,KAAK,CAACoB,QAAQ,IAAI,CAAC,CAAC;MACrC,IAAI,CAACnB,KAAK,IAAI,CAACkB,IAAI,IAAIrB,YAAY,CAACuB,QAAQ,CAACF,IAAI,CAAC,EAAE;QAChD,OAAOlB,KAAK;MAChB;MACA,OAAOF,kBAAkB,CAACC,KAAK,EAAEC,KAAK,CAAC;IAC3C,CAAC;IACDqB,SAAS,EAAE,MAAAA,CAAO;MAAErB,KAAK;MAAED;IAAM,CAAC,KAAK;MACnC,MAAM;QAAEmB;MAAK,CAAC,GAAGnB,KAAK,CAACoB,QAAQ,IAAI,CAAC,CAAC;MACrC,IAAI,CAACnB,KAAK,IAAI,CAACkB,IAAI,IAAIrB,YAAY,CAACuB,QAAQ,CAACF,IAAI,CAAC,EAAE;QAChD,OAAOlB,KAAK;MAChB;MACA,IAAID,KAAK,CAACE,cAAc,EAAE;QACtB,MAAMA,cAAc,GAAGD,KAA6C;QAEpE,OAAO,CAACC,cAAc,IAAI,EAAE,EAAEqB,MAAM,CAAW,CAACC,MAAM,EAAEvB,KAAK,KAAK;UAC9D,IAAI,CAACA,KAAK,EAAE;YACR,OAAOuB,MAAM;UACjB;UACAA,MAAM,CAACC,IAAI,CAAChB,qBAAqB,CAACT,KAAK,EAAEC,KAAK,CAAC,CAAC;UAChD,OAAOuB,MAAM;QACjB,CAAC,EAAE,EAAE,CAAC;MACV;MACA,OAAOf,qBAAqB,CAACT,KAAK,EAAEC,KAAK,CAAC;IAC9C;EACJ,CAAC,CAAC;EACFc,MAAM,CAACW,IAAI,GAAI,6CAA4C;EAE3D,OAAOX,MAAM;AACjB,CAAC;AAACY,OAAA,CAAAb,gCAAA,GAAAA,gCAAA","ignoreList":[]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.japanese = void 0;
|
|
7
|
-
var _CmsEntryElasticsearchIndexPlugin = require("../../plugins/CmsEntryElasticsearchIndexPlugin");
|
|
8
|
-
var _apiElasticsearch = require("@webiny/api-elasticsearch");
|
|
9
|
-
const japanese = exports.japanese = new _CmsEntryElasticsearchIndexPlugin.CmsEntryElasticsearchIndexPlugin({
|
|
10
|
-
body: (0, _apiElasticsearch.getJapaneseConfiguration)(),
|
|
11
|
-
locales: ["ja", "ja-jp"]
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
//# sourceMappingURL=japanese.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_CmsEntryElasticsearchIndexPlugin","require","_apiElasticsearch","japanese","exports","CmsEntryElasticsearchIndexPlugin","body","getJapaneseConfiguration","locales"],"sources":["japanese.ts"],"sourcesContent":["import { CmsEntryElasticsearchIndexPlugin } from \"~/plugins/CmsEntryElasticsearchIndexPlugin\";\nimport { getJapaneseConfiguration } from \"@webiny/api-elasticsearch\";\n\nexport const japanese = new CmsEntryElasticsearchIndexPlugin({\n body: getJapaneseConfiguration(),\n locales: [\"ja\", \"ja-jp\"]\n});\n"],"mappings":";;;;;;AAAA,IAAAA,iCAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAEO,MAAME,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAG,IAAIE,kEAAgC,CAAC;EACzDC,IAAI,EAAE,IAAAC,0CAAwB,EAAC,CAAC;EAChCC,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO;AAC3B,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { CmsSystemStorageOperations } from "@webiny/api-headless-cms/types";
|
|
2
|
-
import { Entity } from "@webiny/db-dynamodb/toolbox";
|
|
3
|
-
export interface CreateSystemStorageOperationsParams {
|
|
4
|
-
entity: Entity<any>;
|
|
5
|
-
}
|
|
6
|
-
export declare const createSystemStorageOperations: (params: CreateSystemStorageOperationsParams) => CmsSystemStorageOperations;
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.createSystemStorageOperations = void 0;
|
|
8
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
-
var _get = require("@webiny/db-dynamodb/utils/get");
|
|
10
|
-
var _dbDynamodb = require("@webiny/db-dynamodb");
|
|
11
|
-
const createPartitionKey = ({
|
|
12
|
-
tenant
|
|
13
|
-
}) => {
|
|
14
|
-
return `T#${tenant.toLowerCase()}#SYSTEM`;
|
|
15
|
-
};
|
|
16
|
-
const createSortKey = () => {
|
|
17
|
-
return "CMS";
|
|
18
|
-
};
|
|
19
|
-
const createKeys = params => {
|
|
20
|
-
return {
|
|
21
|
-
PK: createPartitionKey(params),
|
|
22
|
-
SK: createSortKey()
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
const createSystemStorageOperations = params => {
|
|
26
|
-
const {
|
|
27
|
-
entity
|
|
28
|
-
} = params;
|
|
29
|
-
const create = async ({
|
|
30
|
-
system
|
|
31
|
-
}) => {
|
|
32
|
-
const keys = createKeys(system);
|
|
33
|
-
try {
|
|
34
|
-
await (0, _dbDynamodb.put)({
|
|
35
|
-
entity,
|
|
36
|
-
item: {
|
|
37
|
-
...system,
|
|
38
|
-
...keys
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
return system;
|
|
42
|
-
} catch (ex) {
|
|
43
|
-
throw new _error.default(ex.message || "Could not create system.", ex.code || "CREATE_SYSTEM_ERROR", {
|
|
44
|
-
error: ex,
|
|
45
|
-
system,
|
|
46
|
-
keys
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
const update = async params => {
|
|
51
|
-
const {
|
|
52
|
-
system
|
|
53
|
-
} = params;
|
|
54
|
-
const keys = createKeys(system);
|
|
55
|
-
try {
|
|
56
|
-
await (0, _dbDynamodb.put)({
|
|
57
|
-
entity,
|
|
58
|
-
item: {
|
|
59
|
-
...system,
|
|
60
|
-
...keys
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
return system;
|
|
64
|
-
} catch (ex) {
|
|
65
|
-
throw new _error.default(ex.message || "Could not update system.", ex.code || "UPDATE_SYSTEM_ERROR", {
|
|
66
|
-
error: ex,
|
|
67
|
-
system,
|
|
68
|
-
keys
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
const get = async params => {
|
|
73
|
-
const keys = createKeys(params);
|
|
74
|
-
try {
|
|
75
|
-
return await (0, _get.getClean)({
|
|
76
|
-
entity,
|
|
77
|
-
keys
|
|
78
|
-
});
|
|
79
|
-
} catch (ex) {
|
|
80
|
-
throw new _error.default(ex.message || "Could not get system.", ex.code || "GET_SYSTEM_ERROR", {
|
|
81
|
-
error: ex,
|
|
82
|
-
keys
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
return {
|
|
87
|
-
create,
|
|
88
|
-
update,
|
|
89
|
-
get
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
exports.createSystemStorageOperations = createSystemStorageOperations;
|
|
93
|
-
|
|
94
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","_get","_dbDynamodb","createPartitionKey","tenant","toLowerCase","createSortKey","createKeys","params","PK","SK","createSystemStorageOperations","entity","create","system","keys","put","item","ex","WebinyError","message","code","error","update","get","getClean","exports"],"sources":["index.ts"],"sourcesContent":["import {\n CmsSystem,\n CmsSystemStorageOperations,\n CmsSystemStorageOperationsCreateParams,\n CmsSystemStorageOperationsGetParams,\n CmsSystemStorageOperationsUpdateParams\n} from \"@webiny/api-headless-cms/types\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport WebinyError from \"@webiny/error\";\nimport { getClean } from \"@webiny/db-dynamodb/utils/get\";\nimport { put } from \"@webiny/db-dynamodb\";\n\nexport interface CreateSystemStorageOperationsParams {\n entity: Entity<any>;\n}\n\ninterface PartitionKeyParams {\n tenant: string;\n}\nconst createPartitionKey = ({ tenant }: PartitionKeyParams): string => {\n return `T#${tenant.toLowerCase()}#SYSTEM`;\n};\nconst createSortKey = (): string => {\n return \"CMS\";\n};\n\ninterface Keys {\n PK: string;\n SK: string;\n}\nconst createKeys = (params: PartitionKeyParams): Keys => {\n return {\n PK: createPartitionKey(params),\n SK: createSortKey()\n };\n};\n\nexport const createSystemStorageOperations = (\n params: CreateSystemStorageOperationsParams\n): CmsSystemStorageOperations => {\n const { entity } = params;\n\n const create = async ({ system }: CmsSystemStorageOperationsCreateParams) => {\n const keys = createKeys(system);\n try {\n await put({\n entity,\n item: {\n ...system,\n ...keys\n }\n });\n return system;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create system.\",\n ex.code || \"CREATE_SYSTEM_ERROR\",\n {\n error: ex,\n system,\n keys\n }\n );\n }\n };\n\n const update = async (params: CmsSystemStorageOperationsUpdateParams) => {\n const { system } = params;\n\n const keys = createKeys(system);\n\n try {\n await put({\n entity,\n item: {\n ...system,\n ...keys\n }\n });\n return system;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update system.\",\n ex.code || \"UPDATE_SYSTEM_ERROR\",\n {\n error: ex,\n system,\n keys\n }\n );\n }\n };\n\n const get = async (params: CmsSystemStorageOperationsGetParams) => {\n const keys = createKeys(params);\n\n try {\n return await getClean<CmsSystem>({\n entity,\n keys\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get system.\",\n ex.code || \"GET_SYSTEM_ERROR\",\n {\n error: ex,\n keys\n }\n );\n }\n };\n\n return {\n create,\n update,\n get\n };\n};\n"],"mappings":";;;;;;;AAQA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AASA,MAAMG,kBAAkB,GAAGA,CAAC;EAAEC;AAA2B,CAAC,KAAa;EACnE,OAAQ,KAAIA,MAAM,CAACC,WAAW,CAAC,CAAE,SAAQ;AAC7C,CAAC;AACD,MAAMC,aAAa,GAAGA,CAAA,KAAc;EAChC,OAAO,KAAK;AAChB,CAAC;AAMD,MAAMC,UAAU,GAAIC,MAA0B,IAAW;EACrD,OAAO;IACHC,EAAE,EAAEN,kBAAkB,CAACK,MAAM,CAAC;IAC9BE,EAAE,EAAEJ,aAAa,CAAC;EACtB,CAAC;AACL,CAAC;AAEM,MAAMK,6BAA6B,GACtCH,MAA2C,IACd;EAC7B,MAAM;IAAEI;EAAO,CAAC,GAAGJ,MAAM;EAEzB,MAAMK,MAAM,GAAG,MAAAA,CAAO;IAAEC;EAA+C,CAAC,KAAK;IACzE,MAAMC,IAAI,GAAGR,UAAU,CAACO,MAAM,CAAC;IAC/B,IAAI;MACA,MAAM,IAAAE,eAAG,EAAC;QACNJ,MAAM;QACNK,IAAI,EAAE;UACF,GAAGH,MAAM;UACT,GAAGC;QACP;MACJ,CAAC,CAAC;MACF,OAAOD,MAAM;IACjB,CAAC,CAAC,OAAOI,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,0BAA0B,EACxCF,EAAE,CAACG,IAAI,IAAI,qBAAqB,EAChC;QACIC,KAAK,EAAEJ,EAAE;QACTJ,MAAM;QACNC;MACJ,CACJ,CAAC;IACL;EACJ,CAAC;EAED,MAAMQ,MAAM,GAAG,MAAOf,MAA8C,IAAK;IACrE,MAAM;MAAEM;IAAO,CAAC,GAAGN,MAAM;IAEzB,MAAMO,IAAI,GAAGR,UAAU,CAACO,MAAM,CAAC;IAE/B,IAAI;MACA,MAAM,IAAAE,eAAG,EAAC;QACNJ,MAAM;QACNK,IAAI,EAAE;UACF,GAAGH,MAAM;UACT,GAAGC;QACP;MACJ,CAAC,CAAC;MACF,OAAOD,MAAM;IACjB,CAAC,CAAC,OAAOI,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,0BAA0B,EACxCF,EAAE,CAACG,IAAI,IAAI,qBAAqB,EAChC;QACIC,KAAK,EAAEJ,EAAE;QACTJ,MAAM;QACNC;MACJ,CACJ,CAAC;IACL;EACJ,CAAC;EAED,MAAMS,GAAG,GAAG,MAAOhB,MAA2C,IAAK;IAC/D,MAAMO,IAAI,GAAGR,UAAU,CAACC,MAAM,CAAC;IAE/B,IAAI;MACA,OAAO,MAAM,IAAAiB,aAAQ,EAAY;QAC7Bb,MAAM;QACNG;MACJ,CAAC,CAAC;IACN,CAAC,CAAC,OAAOG,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,uBAAuB,EACrCF,EAAE,CAACG,IAAI,IAAI,kBAAkB,EAC7B;QACIC,KAAK,EAAEJ,EAAE;QACTH;MACJ,CACJ,CAAC;IACL;EACJ,CAAC;EAED,OAAO;IACHF,MAAM;IACNU,MAAM;IACNC;EACJ,CAAC;AACL,CAAC;AAACE,OAAA,CAAAf,6BAAA,GAAAA,6BAAA","ignoreList":[]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CmsContext } from "../../types";
|
|
2
|
-
import { PluginsContainer } from "@webiny/plugins";
|
|
3
|
-
import { Client } from "@elastic/elasticsearch";
|
|
4
|
-
interface Params {
|
|
5
|
-
context: CmsContext;
|
|
6
|
-
client: Client;
|
|
7
|
-
plugins: PluginsContainer;
|
|
8
|
-
}
|
|
9
|
-
export declare const createElasticsearchIndexesOnLocaleAfterCreate: (params: Params) => Promise<void>;
|
|
10
|
-
export {};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createElasticsearchIndexesOnLocaleAfterCreate = void 0;
|
|
7
|
-
var _createElasticsearchIndex = require("../../elasticsearch/createElasticsearchIndex");
|
|
8
|
-
const createElasticsearchIndexesOnLocaleAfterCreate = async params => {
|
|
9
|
-
const {
|
|
10
|
-
context,
|
|
11
|
-
client,
|
|
12
|
-
plugins
|
|
13
|
-
} = params;
|
|
14
|
-
context.i18n.locales.onLocaleAfterCreate.subscribe(async ({
|
|
15
|
-
locale,
|
|
16
|
-
tenant
|
|
17
|
-
}) => {
|
|
18
|
-
/**
|
|
19
|
-
* Get all the code models and create the indexes for them.
|
|
20
|
-
*/
|
|
21
|
-
const models = await context.security.withoutAuthorization(async () => {
|
|
22
|
-
return (await context.cms.listModels()).map(model => {
|
|
23
|
-
return {
|
|
24
|
-
...model,
|
|
25
|
-
tenant,
|
|
26
|
-
locale: locale.code
|
|
27
|
-
};
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
for (const model of models) {
|
|
31
|
-
await (0, _createElasticsearchIndex.createElasticsearchIndex)({
|
|
32
|
-
client,
|
|
33
|
-
plugins,
|
|
34
|
-
model
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
exports.createElasticsearchIndexesOnLocaleAfterCreate = createElasticsearchIndexesOnLocaleAfterCreate;
|
|
40
|
-
|
|
41
|
-
//# sourceMappingURL=indexes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_createElasticsearchIndex","require","createElasticsearchIndexesOnLocaleAfterCreate","params","context","client","plugins","i18n","locales","onLocaleAfterCreate","subscribe","locale","tenant","models","security","withoutAuthorization","cms","listModels","map","model","code","createElasticsearchIndex","exports"],"sources":["indexes.ts"],"sourcesContent":["import { CmsContext } from \"~/types\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { Client } from \"@elastic/elasticsearch\";\nimport { createElasticsearchIndex } from \"~/elasticsearch/createElasticsearchIndex\";\n\ninterface Params {\n context: CmsContext;\n client: Client;\n plugins: PluginsContainer;\n}\n\nexport const createElasticsearchIndexesOnLocaleAfterCreate = async (params: Params) => {\n const { context, client, plugins } = params;\n\n context.i18n.locales.onLocaleAfterCreate.subscribe(async ({ locale, tenant }) => {\n /**\n * Get all the code models and create the indexes for them.\n */\n const models = await context.security.withoutAuthorization(async () => {\n return (await context.cms.listModels()).map(model => {\n return {\n ...model,\n tenant,\n locale: locale.code\n };\n });\n });\n\n for (const model of models) {\n await createElasticsearchIndex({\n client,\n plugins,\n model\n });\n }\n });\n};\n"],"mappings":";;;;;;AAGA,IAAAA,yBAAA,GAAAC,OAAA;AAQO,MAAMC,6CAA6C,GAAG,MAAOC,MAAc,IAAK;EACnF,MAAM;IAAEC,OAAO;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAGH,MAAM;EAE3CC,OAAO,CAACG,IAAI,CAACC,OAAO,CAACC,mBAAmB,CAACC,SAAS,CAAC,OAAO;IAAEC,MAAM;IAAEC;EAAO,CAAC,KAAK;IAC7E;AACR;AACA;IACQ,MAAMC,MAAM,GAAG,MAAMT,OAAO,CAACU,QAAQ,CAACC,oBAAoB,CAAC,YAAY;MACnE,OAAO,CAAC,MAAMX,OAAO,CAACY,GAAG,CAACC,UAAU,CAAC,CAAC,EAAEC,GAAG,CAACC,KAAK,IAAI;QACjD,OAAO;UACH,GAAGA,KAAK;UACRP,MAAM;UACND,MAAM,EAAEA,MAAM,CAACS;QACnB,CAAC;MACL,CAAC,CAAC;IACN,CAAC,CAAC;IAEF,KAAK,MAAMD,KAAK,IAAIN,MAAM,EAAE;MACxB,MAAM,IAAAQ,kDAAwB,EAAC;QAC3BhB,MAAM;QACNC,OAAO;QACPa;MACJ,CAAC,CAAC;IACN;EACJ,CAAC,CAAC;AACN,CAAC;AAACG,OAAA,CAAApB,6CAAA,GAAAA,6CAAA","ignoreList":[]}
|