@webiny/api-headless-cms-ddb-es 6.0.0-beta.0 → 6.0.0-rc.1
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
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { IEntity, IStandardEntityAttributes } from "@webiny/db-dynamodb";
|
|
2
|
+
import type { GenericRecord } from "@webiny/api/types.js";
|
|
3
|
+
import type { CmsEntryStatus, CmsGroup, CmsIdentity, CmsModel, ICmsEntryLocation, IEntryState } from "@webiny/api-headless-cms/types/index.js";
|
|
4
|
+
export interface IEntryEntityAttributesData {
|
|
5
|
+
tenant: string;
|
|
6
|
+
entryId: string;
|
|
7
|
+
id: string;
|
|
8
|
+
modelId: string;
|
|
9
|
+
/**
|
|
10
|
+
* Revision-level meta fields. 👇
|
|
11
|
+
*/
|
|
12
|
+
revisionCreatedOn: string;
|
|
13
|
+
revisionModifiedOn: string | null;
|
|
14
|
+
revisionSavedOn: string;
|
|
15
|
+
revisionDeletedOn: string | null;
|
|
16
|
+
revisionRestoredOn: string | null;
|
|
17
|
+
revisionFirstPublishedOn: string | null;
|
|
18
|
+
revisionLastPublishedOn: string | null;
|
|
19
|
+
revisionCreatedBy: CmsIdentity;
|
|
20
|
+
revisionModifiedBy: CmsIdentity | null;
|
|
21
|
+
revisionSavedBy: CmsIdentity;
|
|
22
|
+
revisionDeletedBy: CmsIdentity | null;
|
|
23
|
+
revisionRestoredBy: CmsIdentity | null;
|
|
24
|
+
revisionFirstPublishedBy: CmsIdentity | null;
|
|
25
|
+
revisionLastPublishedBy: CmsIdentity | null;
|
|
26
|
+
/**
|
|
27
|
+
* Entry-level meta fields. 👇
|
|
28
|
+
*/
|
|
29
|
+
createdOn: string;
|
|
30
|
+
modifiedOn: string | null;
|
|
31
|
+
savedOn: string;
|
|
32
|
+
deletedOn: string | null;
|
|
33
|
+
restoredOn: string | null;
|
|
34
|
+
firstPublishedOn: string | null;
|
|
35
|
+
lastPublishedOn: string | null;
|
|
36
|
+
createdBy: CmsIdentity;
|
|
37
|
+
modifiedBy: CmsIdentity | null;
|
|
38
|
+
savedBy: CmsIdentity;
|
|
39
|
+
deletedBy: CmsIdentity | null;
|
|
40
|
+
restoredBy: CmsIdentity | null;
|
|
41
|
+
firstPublishedBy: CmsIdentity | null;
|
|
42
|
+
lastPublishedBy: CmsIdentity | null;
|
|
43
|
+
/**
|
|
44
|
+
* The rest. 👇
|
|
45
|
+
*/
|
|
46
|
+
version: number;
|
|
47
|
+
locked: boolean;
|
|
48
|
+
status: CmsEntryStatus;
|
|
49
|
+
location?: ICmsEntryLocation;
|
|
50
|
+
wbyDeleted?: boolean | null;
|
|
51
|
+
binOriginalFolderId?: string;
|
|
52
|
+
values: GenericRecord;
|
|
53
|
+
meta?: GenericRecord;
|
|
54
|
+
state?: IEntryState;
|
|
55
|
+
}
|
|
56
|
+
export type IEntryEntityAttributes = IStandardEntityAttributes<IEntryEntityAttributesData>;
|
|
57
|
+
export type IModelEntity = IEntity<IStandardEntityAttributes<CmsModel>>;
|
|
58
|
+
export type IGroupEntity = IEntity<IStandardEntityAttributes<CmsGroup>>;
|
|
59
|
+
export type IEntryEntity = IEntity<IEntryEntityAttributes>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { IEntity, IStandardEntityAttributes } from \"@webiny/db-dynamodb\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport type {\n CmsEntryStatus,\n CmsGroup,\n CmsIdentity,\n CmsModel,\n ICmsEntryLocation,\n IEntryState\n} from \"@webiny/api-headless-cms/types/index.js\";\n\nexport interface IEntryEntityAttributesData {\n tenant: string;\n entryId: string;\n id: string;\n modelId: string;\n\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedOn: string;\n revisionModifiedOn: string | null;\n revisionSavedOn: string;\n revisionDeletedOn: string | null;\n revisionRestoredOn: string | null;\n revisionFirstPublishedOn: string | null;\n revisionLastPublishedOn: string | null;\n revisionCreatedBy: CmsIdentity;\n revisionModifiedBy: CmsIdentity | null;\n revisionSavedBy: CmsIdentity;\n revisionDeletedBy: CmsIdentity | null;\n revisionRestoredBy: CmsIdentity | null;\n revisionFirstPublishedBy: CmsIdentity | null;\n revisionLastPublishedBy: CmsIdentity | null;\n\n /**\n * Entry-level meta fields. 👇\n */\n createdOn: string;\n modifiedOn: string | null;\n savedOn: string;\n deletedOn: string | null;\n restoredOn: string | null;\n firstPublishedOn: string | null;\n lastPublishedOn: string | null;\n createdBy: CmsIdentity;\n modifiedBy: CmsIdentity | null;\n savedBy: CmsIdentity;\n deletedBy: CmsIdentity | null;\n restoredBy: CmsIdentity | null;\n firstPublishedBy: CmsIdentity | null;\n lastPublishedBy: CmsIdentity | null;\n\n /**\n * The rest. 👇\n */\n version: number;\n locked: boolean;\n status: CmsEntryStatus;\n location?: ICmsEntryLocation;\n wbyDeleted?: boolean | null;\n binOriginalFolderId?: string;\n values: GenericRecord;\n meta?: GenericRecord;\n state?: IEntryState;\n}\n\nexport type IEntryEntityAttributes = IStandardEntityAttributes<IEntryEntityAttributesData>;\n\nexport type IModelEntity = IEntity<IStandardEntityAttributes<CmsModel>>;\nexport type IGroupEntity = IEntity<IStandardEntityAttributes<CmsGroup>>;\nexport type IEntryEntity = IEntity<IEntryEntityAttributes>;\n"],"mappings":"","ignoreList":[]}
|
package/dynamoDb/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare const _default: () => import("@webiny/api-headless-cms").StorageTransformPlugin<any, any, import("@webiny/api-headless-cms/types").CmsModelField>[];
|
|
1
|
+
declare const _default: () => import("@webiny/api-headless-cms/index.js").StorageTransformPlugin<any, any, import("@webiny/api-headless-cms/types/modelField.js").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>[];
|
|
3
|
+
export declare const createDynamoDbPlugins: () => import("@webiny/api-headless-cms/index.js").StorageTransformPlugin<any, any, import("@webiny/api-headless-cms/types/modelField.js").CmsModelField>[];
|
package/dynamoDb/index.js
CHANGED
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.default = exports.createDynamoDbPlugins = void 0;
|
|
7
|
-
var _richText = require("./storage/richText");
|
|
8
|
-
var _longText = require("./storage/longText");
|
|
9
|
-
var _date = require("./storage/date");
|
|
10
|
-
var _default = () => createDynamoDbPlugins();
|
|
11
|
-
exports.default = _default;
|
|
12
|
-
const createDynamoDbPlugins = () => {
|
|
13
|
-
return [(0, _richText.createRichTextStorageTransformPlugin)(), (0, _longText.createLongTextStorageTransformPlugin)(), (0, _date.createDateStorageTransformPlugin)()];
|
|
1
|
+
import { createRichTextStorageTransformPlugin } from "./storage/richText.js";
|
|
2
|
+
import { createLongTextStorageTransformPlugin } from "./storage/longText.js";
|
|
3
|
+
export default () => createDynamoDbPlugins();
|
|
4
|
+
export const createDynamoDbPlugins = () => {
|
|
5
|
+
return [createRichTextStorageTransformPlugin(), createLongTextStorageTransformPlugin()];
|
|
14
6
|
};
|
|
15
|
-
exports.createDynamoDbPlugins = createDynamoDbPlugins;
|
|
16
7
|
|
|
17
8
|
//# sourceMappingURL=index.js.map
|
package/dynamoDb/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["createRichTextStorageTransformPlugin","createLongTextStorageTransformPlugin","createDynamoDbPlugins"],"sources":["index.ts"],"sourcesContent":["import { createRichTextStorageTransformPlugin } from \"./storage/richText.js\";\nimport { createLongTextStorageTransformPlugin } from \"./storage/longText.js\";\n\nexport default () => createDynamoDbPlugins();\n\nexport const createDynamoDbPlugins = () => {\n return [createRichTextStorageTransformPlugin(), createLongTextStorageTransformPlugin()];\n};\n"],"mappings":"AAAA,SAASA,oCAAoC;AAC7C,SAASC,oCAAoC;AAE7C,eAAe,MAAMC,qBAAqB,CAAC,CAAC;AAE5C,OAAO,MAAMA,qBAAqB,GAAGA,CAAA,KAAM;EACvC,OAAO,CAACF,oCAAoC,CAAC,CAAC,EAAEC,oCAAoC,CAAC,CAAC,CAAC;AAC3F,CAAC","ignoreList":[]}
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.createLongTextStorageTransformPlugin = void 0;
|
|
8
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
-
var _gzip = require("@webiny/utils/compression/gzip");
|
|
10
|
-
var _apiHeadlessCms = require("@webiny/api-headless-cms");
|
|
11
1
|
/**
|
|
12
2
|
* File is @internal
|
|
13
3
|
*/
|
|
14
4
|
|
|
5
|
+
import WebinyError from "@webiny/error";
|
|
6
|
+
import { compress as gzip, decompress as ungzip } from "@webiny/utils/compression/gzip.js";
|
|
7
|
+
import { StorageTransformPlugin } from "@webiny/api-headless-cms";
|
|
15
8
|
const GZIP = "gzip";
|
|
16
9
|
const TO_STORAGE_ENCODING = "base64";
|
|
17
10
|
const FROM_STORAGE_ENCODING = "utf8";
|
|
@@ -21,8 +14,9 @@ const convertToBuffer = value => {
|
|
|
21
14
|
}
|
|
22
15
|
return value;
|
|
23
16
|
};
|
|
24
|
-
const createLongTextStorageTransformPlugin = () => {
|
|
25
|
-
const plugin = new
|
|
17
|
+
export const createLongTextStorageTransformPlugin = () => {
|
|
18
|
+
const plugin = new StorageTransformPlugin({
|
|
19
|
+
name: "headless-cms.storage-transform.long-text.default",
|
|
26
20
|
fieldType: "long-text",
|
|
27
21
|
fromStorage: async ({
|
|
28
22
|
field,
|
|
@@ -32,7 +26,7 @@ const createLongTextStorageTransformPlugin = () => {
|
|
|
32
26
|
if (!storageValue || typeOf === "string" || typeOf === "number" || Array.isArray(storageValue) === true) {
|
|
33
27
|
return storageValue;
|
|
34
28
|
} else if (typeOf !== "object") {
|
|
35
|
-
throw new
|
|
29
|
+
throw new WebinyError(`LongText value received in "fromStorage" function is not an object in field "${field.storageId}" - ${field.fieldId}.`);
|
|
36
30
|
}
|
|
37
31
|
const {
|
|
38
32
|
compression,
|
|
@@ -43,16 +37,16 @@ const createLongTextStorageTransformPlugin = () => {
|
|
|
43
37
|
* Check if possibly undefined, null, empty...
|
|
44
38
|
*/
|
|
45
39
|
if (!compression) {
|
|
46
|
-
throw new
|
|
40
|
+
throw new WebinyError(`Missing compression in "fromStorage" function in field "${field.storageId}" - ${field.fieldId}.": ${JSON.stringify(storageValue)}.`, "MISSING_COMPRESSION", {
|
|
47
41
|
value: storageValue
|
|
48
42
|
});
|
|
49
43
|
} else if (compression !== GZIP) {
|
|
50
|
-
throw new
|
|
44
|
+
throw new WebinyError(`This plugin cannot transform something not compressed with "GZIP".`, "WRONG_COMPRESSION", {
|
|
51
45
|
compression
|
|
52
46
|
});
|
|
53
47
|
}
|
|
54
48
|
try {
|
|
55
|
-
const buf = await (
|
|
49
|
+
const buf = await ungzip(convertToBuffer(value));
|
|
56
50
|
const result = buf.toString(FROM_STORAGE_ENCODING);
|
|
57
51
|
if (!isArray) {
|
|
58
52
|
return result;
|
|
@@ -75,7 +69,7 @@ const createLongTextStorageTransformPlugin = () => {
|
|
|
75
69
|
}
|
|
76
70
|
const isArray = Array.isArray(initialValue);
|
|
77
71
|
const value = isArray ? JSON.stringify(initialValue) : initialValue;
|
|
78
|
-
const compressedValue = await (
|
|
72
|
+
const compressedValue = await gzip(value);
|
|
79
73
|
const result = {
|
|
80
74
|
compression: GZIP,
|
|
81
75
|
value: compressedValue.toString(TO_STORAGE_ENCODING)
|
|
@@ -90,6 +84,5 @@ const createLongTextStorageTransformPlugin = () => {
|
|
|
90
84
|
plugin.name = plugin.name = `headless-cms.dynamodb.storageTransform.long-text`;
|
|
91
85
|
return plugin;
|
|
92
86
|
};
|
|
93
|
-
exports.createLongTextStorageTransformPlugin = createLongTextStorageTransformPlugin;
|
|
94
87
|
|
|
95
88
|
//# sourceMappingURL=longText.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["WebinyError","compress","gzip","decompress","ungzip","StorageTransformPlugin","GZIP","TO_STORAGE_ENCODING","FROM_STORAGE_ENCODING","convertToBuffer","value","Buffer","from","createLongTextStorageTransformPlugin","plugin","name","fieldType","fromStorage","field","storageValue","typeOf","Array","isArray","storageId","fieldId","compression","JSON","stringify","buf","result","toString","parse","ex","console","log","message","toStorage","initialValue","hasOwnProperty","compressedValue"],"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.js\";\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,7 +1,2 @@
|
|
|
1
1
|
import { StorageTransformPlugin } from "@webiny/api-headless-cms";
|
|
2
|
-
export declare type OriginalValue = Record<string, any> | any[];
|
|
3
|
-
export interface StorageValue {
|
|
4
|
-
compression: string;
|
|
5
|
-
value: any;
|
|
6
|
-
}
|
|
7
2
|
export declare const createRichTextStorageTransformPlugin: () => StorageTransformPlugin<any, any, import("@webiny/api-headless-cms/types").CmsModelField>;
|
|
@@ -1,106 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
exports.createRichTextStorageTransformPlugin = void 0;
|
|
8
|
-
var _jsonpack = _interopRequireDefault(require("jsonpack"));
|
|
9
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
10
|
-
var _apiHeadlessCms = require("@webiny/api-headless-cms");
|
|
11
|
-
/**
|
|
12
|
-
* Remove when jsonpack gets PR with a fix merged
|
|
13
|
-
* https://github.com/rgcl/jsonpack/pull/25/files
|
|
14
|
-
* NOTE 2021-07-28: it seems PR is not going to be merged so keep this.
|
|
15
|
-
*/
|
|
16
|
-
// TODO @ts-refactor figure better type
|
|
17
|
-
const transformArray = value => {
|
|
18
|
-
if (!value) {
|
|
19
|
-
return value;
|
|
20
|
-
}
|
|
21
|
-
let isArray = Array.isArray(value);
|
|
22
|
-
const shouldBeArray = value instanceof Array === false && isArray;
|
|
23
|
-
if (shouldBeArray) {
|
|
24
|
-
value = Array.from(value);
|
|
25
|
-
isArray = true;
|
|
26
|
-
}
|
|
27
|
-
if (typeof value === "object" || isArray) {
|
|
28
|
-
for (const k in value) {
|
|
29
|
-
value[k] = transformArray(value[k]);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return value;
|
|
33
|
-
};
|
|
34
|
-
const createRichTextStorageTransformPlugin = () => {
|
|
35
|
-
const plugin = new _apiHeadlessCms.StorageTransformPlugin({
|
|
1
|
+
import WebinyError from "@webiny/error";
|
|
2
|
+
import { StorageTransformPlugin } from "@webiny/api-headless-cms";
|
|
3
|
+
import { CompressorPlugin } from "@webiny/api";
|
|
4
|
+
export const createRichTextStorageTransformPlugin = () => {
|
|
5
|
+
const plugin = new StorageTransformPlugin({
|
|
6
|
+
name: "headless-cms.storage-transform.rich-text.default",
|
|
36
7
|
fieldType: "rich-text",
|
|
37
8
|
fromStorage: async ({
|
|
38
9
|
field,
|
|
39
|
-
value: storageValue
|
|
10
|
+
value: storageValue,
|
|
11
|
+
plugins
|
|
40
12
|
}) => {
|
|
41
13
|
if (!storageValue) {
|
|
42
14
|
return storageValue;
|
|
43
15
|
} else if (typeof storageValue !== "object") {
|
|
44
|
-
throw new
|
|
16
|
+
throw new WebinyError(`RichText value received in "fromStorage" function is not an object in field "${field.storageId}" - ${field.fieldId}.`);
|
|
45
17
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (!storageValue["compression"]) {
|
|
18
|
+
let compressor;
|
|
19
|
+
try {
|
|
20
|
+
compressor = plugins.oneByType(CompressorPlugin.type);
|
|
21
|
+
} catch {
|
|
51
22
|
return storageValue;
|
|
52
23
|
}
|
|
53
|
-
const {
|
|
54
|
-
compression,
|
|
55
|
-
value
|
|
56
|
-
} = storageValue;
|
|
57
|
-
if (compression !== "jsonpack") {
|
|
58
|
-
throw new _error.default(`This plugin cannot transform something not packed with "jsonpack".`, "WRONG_COMPRESSION", {
|
|
59
|
-
compression
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* No point in going further if no value.
|
|
64
|
-
*/
|
|
65
|
-
if (!value) {
|
|
66
|
-
return null;
|
|
67
|
-
}
|
|
68
24
|
try {
|
|
69
|
-
return
|
|
70
|
-
} catch
|
|
71
|
-
return
|
|
25
|
+
return await compressor.getCompressor().decompress(storageValue);
|
|
26
|
+
} catch {
|
|
27
|
+
return storageValue;
|
|
72
28
|
}
|
|
73
29
|
},
|
|
74
30
|
toStorage: async ({
|
|
75
|
-
value
|
|
31
|
+
value,
|
|
32
|
+
plugins
|
|
76
33
|
}) => {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if (!!value?.compression) {
|
|
34
|
+
let compressor;
|
|
35
|
+
try {
|
|
36
|
+
compressor = plugins.oneByType(CompressorPlugin.type);
|
|
37
|
+
} catch {
|
|
82
38
|
return value;
|
|
83
39
|
}
|
|
84
|
-
value = transformArray(value);
|
|
85
|
-
let jsonValue = null;
|
|
86
40
|
try {
|
|
87
|
-
|
|
88
|
-
} catch
|
|
89
|
-
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
console.log("Error while compressing rich-text.");
|
|
93
|
-
console.log(ex.message);
|
|
41
|
+
return await compressor.getCompressor().compress(value);
|
|
42
|
+
} catch {
|
|
43
|
+
return value;
|
|
94
44
|
}
|
|
95
|
-
return {
|
|
96
|
-
compression: "jsonpack",
|
|
97
|
-
value: jsonValue
|
|
98
|
-
};
|
|
99
45
|
}
|
|
100
46
|
});
|
|
101
47
|
plugin.name = `headless-cms.dynamodb.storageTransform.rich-text`;
|
|
102
48
|
return plugin;
|
|
103
49
|
};
|
|
104
|
-
exports.createRichTextStorageTransformPlugin = createRichTextStorageTransformPlugin;
|
|
105
50
|
|
|
106
51
|
//# sourceMappingURL=richText.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["WebinyError","StorageTransformPlugin","CompressorPlugin","createRichTextStorageTransformPlugin","plugin","name","fieldType","fromStorage","field","value","storageValue","plugins","storageId","fieldId","compressor","oneByType","type","getCompressor","decompress","toStorage","compress"],"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 {\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 {\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,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,sBAAsB,QAAQ,0BAA0B;AACjE,SAASC,gBAAgB,QAAQ,aAAa;AAE9C,OAAO,MAAMC,oCAAoC,GAAGA,CAAA,KAAM;EACtD,MAAMC,MAAM,GAAG,IAAIH,sBAAsB,CAAC;IACtCI,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,IAAIV,WAAW,CACjB,gFAAgFQ,KAAK,CAACI,SAAS,OAAOJ,KAAK,CAACK,OAAO,GACvH,CAAC;MACL;MAEA,IAAIC,UAA4B;MAEhC,IAAI;QACAA,UAAU,GAAGH,OAAO,CAACI,SAAS,CAAmBb,gBAAgB,CAACc,IAAI,CAAC;MAC3E,CAAC,CAAC,MAAM;QACJ,OAAON,YAAY;MACvB;MAEA,IAAI;QACA,OAAO,MAAMI,UAAU,CAACG,aAAa,CAAC,CAAC,CAACC,UAAU,CAACR,YAAY,CAAC;MACpE,CAAC,CAAC,MAAM;QACJ,OAAOA,YAAY;MACvB;IACJ,CAAC;IACDS,SAAS,EAAE,MAAAA,CAAO;MAAEV,KAAK;MAAEE;IAAQ,CAAC,KAAK;MACrC,IAAIG,UAA4B;MAEhC,IAAI;QACAA,UAAU,GAAGH,OAAO,CAACI,SAAS,CAAmBb,gBAAgB,CAACc,IAAI,CAAC;MAC3E,CAAC,CAAC,MAAM;QACJ,OAAOP,KAAK;MAChB;MACA,IAAI;QACA,OAAO,MAAMK,UAAU,CAACG,aAAa,CAAC,CAAC,CAACG,QAAQ,CAACX,KAAK,CAAC;MAC3D,CAAC,CAAC,MAAM;QACJ,OAAOA,KAAK;MAChB;IACJ;EACJ,CAAC,CAAC;EACFL,MAAM,CAACC,IAAI,GAAG,kDAAkD;EAEhE,OAAOD,MAAM;AACjB,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Client } from "@elastic/elasticsearch";
|
|
2
|
-
import { PluginsContainer } from "@webiny/plugins";
|
|
3
|
-
import { CmsModel } from "@webiny/api-headless-cms/types";
|
|
1
|
+
import type { Client } from "@elastic/elasticsearch";
|
|
2
|
+
import type { PluginsContainer } from "@webiny/plugins";
|
|
3
|
+
import type { CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
4
4
|
export interface CreateElasticsearchIndexParams {
|
|
5
5
|
client: Client;
|
|
6
6
|
plugins: PluginsContainer;
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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 => {
|
|
1
|
+
import { CmsEntryElasticsearchIndexPlugin } from "../plugins/CmsEntryElasticsearchIndexPlugin.js";
|
|
2
|
+
import { createIndex } from "@webiny/api-elasticsearch";
|
|
3
|
+
import { configurations } from "../configurations.js";
|
|
4
|
+
export const createElasticsearchIndex = async params => {
|
|
11
5
|
const {
|
|
12
6
|
client,
|
|
13
7
|
plugins,
|
|
@@ -15,15 +9,14 @@ const createElasticsearchIndex = async params => {
|
|
|
15
9
|
} = params;
|
|
16
10
|
const {
|
|
17
11
|
index
|
|
18
|
-
} =
|
|
12
|
+
} = configurations.es({
|
|
19
13
|
model
|
|
20
14
|
});
|
|
21
|
-
await
|
|
15
|
+
await createIndex({
|
|
22
16
|
client,
|
|
23
17
|
index,
|
|
24
|
-
type:
|
|
18
|
+
type: CmsEntryElasticsearchIndexPlugin.type,
|
|
25
19
|
tenant: model.tenant,
|
|
26
|
-
locale: model.locale,
|
|
27
20
|
plugins,
|
|
28
21
|
onExists: () => {
|
|
29
22
|
console.log(`Elasticsearch index "${index}" for the CMS model "${model.name}" already exists.`);
|
|
@@ -35,6 +28,5 @@ const createElasticsearchIndex = async params => {
|
|
|
35
28
|
}
|
|
36
29
|
});
|
|
37
30
|
};
|
|
38
|
-
exports.createElasticsearchIndex = createElasticsearchIndex;
|
|
39
31
|
|
|
40
32
|
//# sourceMappingURL=createElasticsearchIndex.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["CmsEntryElasticsearchIndexPlugin","createIndex","configurations","createElasticsearchIndex","params","client","plugins","model","index","es","type","tenant","onExists","console","log","name","onError","ex","error"],"sources":["createElasticsearchIndex.ts"],"sourcesContent":["import type { Client } from \"@elastic/elasticsearch\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport { CmsEntryElasticsearchIndexPlugin } from \"~/plugins/CmsEntryElasticsearchIndexPlugin.js\";\nimport { createIndex } from \"@webiny/api-elasticsearch\";\nimport { configurations } from \"~/configurations.js\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\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 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,SAASA,gCAAgC;AACzC,SAASC,WAAW,QAAQ,2BAA2B;AACvD,SAASC,cAAc;AASvB,OAAO,MAAMC,wBAAwB,GAAG,MAAOC,MAAsC,IAAK;EACtF,MAAM;IAAEC,MAAM;IAAEC,OAAO;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAEzC,MAAM;IAAEI;EAAM,CAAC,GAAGN,cAAc,CAACO,EAAE,CAAC;IAChCF;EACJ,CAAC,CAAC;EAEF,MAAMN,WAAW,CAAC;IACdI,MAAM;IACNG,KAAK;IACLE,IAAI,EAAEV,gCAAgC,CAACU,IAAI;IAC3CC,MAAM,EAAEJ,KAAK,CAACI,MAAM;IACpBL,OAAO;IACPM,QAAQ,EAAEA,CAAA,KAAM;MACZC,OAAO,CAACC,GAAG,CACP,wBAAwBN,KAAK,wBAAwBD,KAAK,CAACQ,IAAI,mBACnE,CAAC;IACL,CAAC;IACDC,OAAO,EAAEC,EAAE,IAAI;MACXJ,OAAO,CAACK,KAAK,CACT,yCAAyCV,KAAK,wBAAwBD,KAAK,CAACQ,IAAI,IACpF,CAAC;MACDF,OAAO,CAACK,KAAK,CAACD,EAAE,CAAC;MACjB,OAAOA,EAAE;IACb;EACJ,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Client } from "@elastic/elasticsearch";
|
|
2
|
-
import { CmsModel } from "@webiny/api-headless-cms/types";
|
|
1
|
+
import type { Client } from "@elastic/elasticsearch";
|
|
2
|
+
import type { CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
3
3
|
interface DeleteElasticsearchIndexParams {
|
|
4
4
|
client: Client;
|
|
5
5
|
model: CmsModel;
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.deleteElasticsearchIndex = void 0;
|
|
7
|
-
var _configurations = require("../configurations");
|
|
8
|
-
const deleteElasticsearchIndex = async params => {
|
|
1
|
+
import { configurations } from "../configurations.js";
|
|
2
|
+
export const deleteElasticsearchIndex = async params => {
|
|
9
3
|
const {
|
|
10
4
|
client,
|
|
11
5
|
model
|
|
12
6
|
} = params;
|
|
13
7
|
const {
|
|
14
8
|
index
|
|
15
|
-
} =
|
|
9
|
+
} = configurations.es({
|
|
16
10
|
model
|
|
17
11
|
});
|
|
18
12
|
const {
|
|
@@ -33,6 +27,5 @@ const deleteElasticsearchIndex = async params => {
|
|
|
33
27
|
console.log(ex.message);
|
|
34
28
|
}
|
|
35
29
|
};
|
|
36
|
-
exports.deleteElasticsearchIndex = deleteElasticsearchIndex;
|
|
37
30
|
|
|
38
31
|
//# sourceMappingURL=deleteElasticsearchIndex.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["configurations","deleteElasticsearchIndex","params","client","model","index","es","body","exists","indices","delete","ignore_unavailable","ex","console","log","message"],"sources":["deleteElasticsearchIndex.ts"],"sourcesContent":["import type { Client } from \"@elastic/elasticsearch\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport { configurations } from \"~/configurations.js\";\n\ninterface DeleteElasticsearchIndexParams {\n client: Client;\n model: CmsModel;\n}\n\nexport const deleteElasticsearchIndex = async (\n params: DeleteElasticsearchIndexParams\n): Promise<void> => {\n const { client, model } = params;\n\n const { index } = configurations.es({\n model\n });\n const { body: exists } = await client.indices.exists({\n index\n });\n if (!exists) {\n return;\n }\n\n try {\n await client.indices.delete({\n index,\n ignore_unavailable: true\n });\n } catch (ex) {\n console.log(`Could not delete Elasticsearch index \"${index}\". Please do it manually.`);\n console.log(ex.message);\n }\n};\n"],"mappings":"AAEA,SAASA,cAAc;AAOvB,OAAO,MAAMC,wBAAwB,GAAG,MACpCC,MAAsC,IACtB;EAChB,MAAM;IAAEC,MAAM;IAAEC;EAAM,CAAC,GAAGF,MAAM;EAEhC,MAAM;IAAEG;EAAM,CAAC,GAAGL,cAAc,CAACM,EAAE,CAAC;IAChCF;EACJ,CAAC,CAAC;EACF,MAAM;IAAEG,IAAI,EAAEC;EAAO,CAAC,GAAG,MAAML,MAAM,CAACM,OAAO,CAACD,MAAM,CAAC;IACjDH;EACJ,CAAC,CAAC;EACF,IAAI,CAACG,MAAM,EAAE;IACT;EACJ;EAEA,IAAI;IACA,MAAML,MAAM,CAACM,OAAO,CAACC,MAAM,CAAC;MACxBL,KAAK;MACLM,kBAAkB,EAAE;IACxB,CAAC,CAAC;EACN,CAAC,CAAC,OAAOC,EAAE,EAAE;IACTC,OAAO,CAACC,GAAG,CAAC,yCAAyCT,KAAK,2BAA2B,CAAC;IACtFQ,OAAO,CAACC,GAAG,CAACF,EAAE,CAACG,OAAO,CAAC;EAC3B;AACJ,CAAC","ignoreList":[]}
|
package/elasticsearch/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: () => (import("../types").CmsModelFieldToElasticsearchPlugin[] | import("
|
|
1
|
+
declare const _default: () => (import("../types.js").CmsModelFieldToElasticsearchPlugin[] | import("../index.js").CmsEntryElasticsearchQueryBuilderValueSearchPlugin[])[];
|
|
2
2
|
export default _default;
|
package/elasticsearch/index.js
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _indexing = _interopRequireDefault(require("./indexing"));
|
|
9
|
-
var _search = _interopRequireDefault(require("./search"));
|
|
10
|
-
var _default = () => [(0, _indexing.default)(), (0, _search.default)()];
|
|
11
|
-
exports.default = _default;
|
|
1
|
+
import elasticsearchIndexingPlugins from "./indexing/index.js";
|
|
2
|
+
import elasticsearchSearchPlugins from "./search/index.js";
|
|
3
|
+
export default () => [elasticsearchIndexingPlugins(), elasticsearchSearchPlugins()];
|
|
12
4
|
|
|
13
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["elasticsearchIndexingPlugins","elasticsearchSearchPlugins"],"sources":["index.ts"],"sourcesContent":["import elasticsearchIndexingPlugins from \"./indexing/index.js\";\nimport elasticsearchSearchPlugins from \"./search/index.js\";\n\nexport default () => [elasticsearchIndexingPlugins(), elasticsearchSearchPlugins()];\n"],"mappings":"AAAA,OAAOA,4BAA4B;AACnC,OAAOC,0BAA0B;AAEjC,eAAe,MAAM,CAACD,4BAA4B,CAAC,CAAC,EAAEC,0BAA0B,CAAC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
1
|
const convertTimeToNumber = time => {
|
|
8
2
|
if (!time) {
|
|
9
3
|
return null;
|
|
@@ -48,7 +42,7 @@ const convertValueToIndex = (value, field) => {
|
|
|
48
42
|
}
|
|
49
43
|
return value;
|
|
50
44
|
};
|
|
51
|
-
|
|
45
|
+
export default () => ({
|
|
52
46
|
type: "cms-model-field-to-elastic-search",
|
|
53
47
|
name: "cms-model-field-to-elastic-search-datetime",
|
|
54
48
|
fieldType: "datetime",
|
|
@@ -83,6 +77,5 @@ var _default = () => ({
|
|
|
83
77
|
return convertValueFromIndex(value, field);
|
|
84
78
|
}
|
|
85
79
|
});
|
|
86
|
-
exports.default = _default;
|
|
87
80
|
|
|
88
81
|
//# sourceMappingURL=dateTimeIndexing.js.map
|