@webiny/api-headless-cms-ddb-es 6.3.0-beta.4 → 6.4.0-beta.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/configurations.js +27 -35
- package/configurations.js.map +1 -1
- package/definitions/entry.js +7 -9
- package/definitions/entry.js.map +1 -1
- package/definitions/group.js +7 -9
- package/definitions/group.js.map +1 -1
- package/definitions/model.js +7 -9
- package/definitions/model.js.map +1 -1
- package/definitions/types.d.ts +1 -0
- package/definitions/types.js +0 -3
- package/elasticsearch/createElasticsearchIndex.js +50 -67
- package/elasticsearch/createElasticsearchIndex.js.map +1 -1
- package/elasticsearch/deleteElasticsearchIndex.js +18 -26
- package/elasticsearch/deleteElasticsearchIndex.js.map +1 -1
- package/exports/api/cms/opensearch.js +2 -4
- package/feature.js +144 -153
- package/feature.js.map +1 -1
- package/features/CmsEntryOpenSearchBodyModifier/abstractions.js +2 -1
- package/features/CmsEntryOpenSearchBodyModifier/abstractions.js.map +1 -1
- package/features/CmsEntryOpenSearchBodyModifier/index.js +0 -2
- package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js +28 -27
- package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js.map +1 -1
- package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js +2 -1
- package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js.map +1 -1
- package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.js +2 -1
- package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.js.map +1 -1
- package/features/CmsEntryOpenSearchFieldIndex/constants.js +2 -1
- package/features/CmsEntryOpenSearchFieldIndex/constants.js.map +1 -1
- package/features/CmsEntryOpenSearchFieldIndex/feature.js +13 -12
- package/features/CmsEntryOpenSearchFieldIndex/feature.js.map +1 -1
- package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.js +48 -65
- package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.js.map +1 -1
- package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js +20 -30
- package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js.map +1 -1
- package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.js +15 -16
- package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.js.map +1 -1
- package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.js +15 -18
- package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.js.map +1 -1
- package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.js +24 -29
- package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.js.map +1 -1
- package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js +99 -144
- package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js.map +1 -1
- package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.js +15 -16
- package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.js.map +1 -1
- package/features/CmsEntryOpenSearchFieldIndex/index.js +0 -2
- package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.js +26 -28
- package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.js.map +1 -1
- package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.js +2 -1
- package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.js.map +1 -1
- package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.js +2 -1
- package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.js.map +1 -1
- package/features/CmsEntryOpenSearchFilter/constants.js +2 -1
- package/features/CmsEntryOpenSearchFilter/constants.js.map +1 -1
- package/features/CmsEntryOpenSearchFilter/feature.js +9 -8
- package/features/CmsEntryOpenSearchFilter/feature.js.map +1 -1
- package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.js +18 -15
- package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.js.map +1 -1
- package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.js +35 -53
- package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.js.map +1 -1
- package/features/CmsEntryOpenSearchFilter/fields/RefFilter.js +27 -40
- package/features/CmsEntryOpenSearchFilter/fields/RefFilter.js.map +1 -1
- package/features/CmsEntryOpenSearchFilter/index.js +0 -2
- package/features/CmsEntryOpenSearchFullTextSearch/abstractions.js +2 -1
- package/features/CmsEntryOpenSearchFullTextSearch/abstractions.js.map +1 -1
- package/features/CmsEntryOpenSearchFullTextSearch/index.js +0 -2
- package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.js +10 -9
- package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.js.map +1 -1
- package/features/CmsEntryOpenSearchIndex/abstractions.js +2 -1
- package/features/CmsEntryOpenSearchIndex/abstractions.js.map +1 -1
- package/features/CmsEntryOpenSearchIndex/feature.js +6 -5
- package/features/CmsEntryOpenSearchIndex/feature.js.map +1 -1
- package/features/CmsEntryOpenSearchIndex/index.js +0 -2
- package/features/CmsEntryOpenSearchQueryModifier/abstractions.js +2 -1
- package/features/CmsEntryOpenSearchQueryModifier/abstractions.js.map +1 -1
- package/features/CmsEntryOpenSearchQueryModifier/index.js +0 -2
- package/features/CmsEntryOpenSearchSortModifier/abstractions.js +2 -1
- package/features/CmsEntryOpenSearchSortModifier/abstractions.js.map +1 -1
- package/features/CmsEntryOpenSearchSortModifier/index.js +0 -2
- package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.js +24 -20
- package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.js.map +1 -1
- package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.js +2 -1
- package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.js.map +1 -1
- package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.js +2 -1
- package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.js.map +1 -1
- package/features/CmsEntryOpenSearchValueSearch/feature.js +9 -8
- package/features/CmsEntryOpenSearchValueSearch/feature.js.map +1 -1
- package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.js +14 -16
- package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.js.map +1 -1
- package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.js +31 -42
- package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.js.map +1 -1
- package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.js +15 -17
- package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.js.map +1 -1
- package/features/CmsEntryOpenSearchValueSearch/index.js +0 -2
- package/features/CmsEntryOpenSearchValuesModifier/abstractions.js +2 -1
- package/features/CmsEntryOpenSearchValuesModifier/abstractions.js.map +1 -1
- package/features/CmsEntryOpenSearchValuesModifier/index.js +0 -2
- package/helpers/entryIndexHelpers.js +71 -123
- package/helpers/entryIndexHelpers.js.map +1 -1
- package/helpers/fieldIdentifier.js +18 -30
- package/helpers/fieldIdentifier.js.map +1 -1
- package/helpers/index.js +0 -2
- package/index.js +0 -2
- package/operations/entry/dataLoader/DataLoaderCache.js +22 -26
- package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
- package/operations/entry/dataLoader/constants.js +2 -1
- package/operations/entry/dataLoader/constants.js.map +1 -1
- package/operations/entry/dataLoader/createBatchScheduleFn.js +6 -15
- package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
- package/operations/entry/dataLoader/getAllEntryRevisions.js +18 -29
- package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +27 -37
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +27 -37
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
- package/operations/entry/dataLoader/getRevisionById.js +32 -46
- package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
- package/operations/entry/dataLoader/index.js +8 -9
- package/operations/entry/dataLoader/index.js.map +1 -1
- package/operations/entry/dataLoader/types.js +0 -3
- package/operations/entry/dataLoaders.js +81 -99
- package/operations/entry/dataLoaders.js.map +1 -1
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +6 -24
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +1 -1
- package/operations/entry/elasticsearch/body.js +74 -125
- package/operations/entry/elasticsearch/body.js.map +1 -1
- package/operations/entry/elasticsearch/fields/createSystemField.js +6 -7
- package/operations/entry/elasticsearch/fields/createSystemField.js.map +1 -1
- package/operations/entry/elasticsearch/fields/live.js +45 -40
- package/operations/entry/elasticsearch/fields/live.js.map +1 -1
- package/operations/entry/elasticsearch/fields/location.js +45 -40
- package/operations/entry/elasticsearch/fields/location.js.map +1 -1
- package/operations/entry/elasticsearch/fields/state.js +99 -88
- package/operations/entry/elasticsearch/fields/state.js.map +1 -1
- package/operations/entry/elasticsearch/fields.js +193 -217
- package/operations/entry/elasticsearch/fields.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/applyFiltering.js +32 -45
- package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/exec.js +85 -114
- package/operations/entry/elasticsearch/filtering/exec.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/index.js +0 -2
- package/operations/entry/elasticsearch/filtering/path.js +24 -33
- package/operations/entry/elasticsearch/filtering/path.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/populated.js +8 -14
- package/operations/entry/elasticsearch/filtering/populated.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/values.js +11 -12
- package/operations/entry/elasticsearch/filtering/values.js.map +1 -1
- package/operations/entry/elasticsearch/fullTextSearch.js +43 -80
- package/operations/entry/elasticsearch/fullTextSearch.js.map +1 -1
- package/operations/entry/elasticsearch/fullTextSearchFields.js +7 -17
- package/operations/entry/elasticsearch/fullTextSearchFields.js.map +1 -1
- package/operations/entry/elasticsearch/initialQuery.js +37 -80
- package/operations/entry/elasticsearch/initialQuery.js.map +1 -1
- package/operations/entry/elasticsearch/keyword.js +13 -27
- package/operations/entry/elasticsearch/keyword.js.map +1 -1
- package/operations/entry/elasticsearch/plugins/operator.js +9 -20
- package/operations/entry/elasticsearch/plugins/operator.js.map +1 -1
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +6 -4
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js.map +1 -1
- package/operations/entry/elasticsearch/sort.js +69 -92
- package/operations/entry/elasticsearch/sort.js.map +1 -1
- package/operations/entry/elasticsearch/transformValueForSearch.js +9 -14
- package/operations/entry/elasticsearch/transformValueForSearch.js.map +1 -1
- package/operations/entry/elasticsearch/types.js +0 -3
- package/operations/entry/index.js +1322 -1709
- package/operations/entry/index.js.map +1 -1
- package/operations/entry/keys.js +43 -63
- package/operations/entry/keys.js.map +1 -1
- package/operations/entry/recordType.js +4 -9
- package/operations/entry/recordType.js.map +1 -1
- package/operations/entry/transformations/convertEntryKeys.js +21 -26
- package/operations/entry/transformations/convertEntryKeys.js.map +1 -1
- package/operations/entry/transformations/index.js +85 -114
- package/operations/entry/transformations/index.js.map +1 -1
- package/operations/entry/transformations/modifyEntryValues.d.ts +1 -1
- package/operations/entry/transformations/modifyEntryValues.js +12 -17
- package/operations/entry/transformations/modifyEntryValues.js.map +1 -1
- package/operations/entry/transformations/transformEntryKeys.js +13 -16
- package/operations/entry/transformations/transformEntryKeys.js.map +1 -1
- package/operations/entry/transformations/transformEntryToIndex.js +17 -22
- package/operations/entry/transformations/transformEntryToIndex.js.map +1 -1
- package/operations/group/index.js +113 -134
- package/operations/group/index.js.map +1 -1
- package/operations/model/index.js +128 -156
- package/operations/model/index.js.map +1 -1
- package/package.json +23 -23
- package/tasks/createIndexTaskPlugin.js +35 -38
- package/tasks/createIndexTaskPlugin.js.map +1 -1
- package/types.js +7 -13
- package/types.js.map +1 -1
- package/values/NoValueContainer.js +8 -10
- package/values/NoValueContainer.js.map +1 -1
- package/definitions/types.js.map +0 -1
- package/exports/api/cms/opensearch.js.map +0 -1
- package/features/CmsEntryOpenSearchBodyModifier/index.js.map +0 -1
- package/features/CmsEntryOpenSearchFieldIndex/index.js.map +0 -1
- package/features/CmsEntryOpenSearchFilter/index.js.map +0 -1
- package/features/CmsEntryOpenSearchFullTextSearch/index.js.map +0 -1
- package/features/CmsEntryOpenSearchIndex/index.js.map +0 -1
- package/features/CmsEntryOpenSearchQueryModifier/index.js.map +0 -1
- package/features/CmsEntryOpenSearchSortModifier/index.js.map +0 -1
- package/features/CmsEntryOpenSearchValueSearch/index.js.map +0 -1
- package/features/CmsEntryOpenSearchValuesModifier/index.js.map +0 -1
- package/helpers/index.js.map +0 -1
- package/index.js.map +0 -1
- package/operations/entry/dataLoader/types.js.map +0 -1
- package/operations/entry/elasticsearch/filtering/index.js.map +0 -1
- package/operations/entry/elasticsearch/types.js.map +0 -1
package/feature.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createTable, registerExtension
|
|
2
|
-
import { StorageOperationsFactory
|
|
1
|
+
import { createTable, registerExtension } from "@webiny/db-dynamodb";
|
|
2
|
+
import { StorageOperationsFactory } from "@webiny/api-headless-cms/exports/api/cms/storage.js";
|
|
3
3
|
import { ENTITIES } from "./types.js";
|
|
4
4
|
import { createRegisterExtensionPlugin } from "@webiny/handler";
|
|
5
5
|
import { createFeature } from "@webiny/feature/api/index.js";
|
|
@@ -27,162 +27,153 @@ import { CmsEntryOpenSearchFullTextSearch } from "./features/CmsEntryOpenSearchF
|
|
|
27
27
|
import { CmsEntryOpenSearchValuesModifier } from "./features/CmsEntryOpenSearchValuesModifier/index.js";
|
|
28
28
|
import { CmsEntryOpenSearchFieldIndexFeature, CmsEntryOpenSearchFieldIndexRegistry } from "./features/CmsEntryOpenSearchFieldIndex/index.js";
|
|
29
29
|
import { CmsEntryOpenSearchFilterFeature, CmsEntryOpenSearchFilterRegistry } from "./features/CmsEntryOpenSearchFilter/index.js";
|
|
30
|
-
const createOpenSearchStorageOperations = params
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
entity: entities.groups,
|
|
149
|
-
container
|
|
150
|
-
}),
|
|
151
|
-
models: createModelsStorageOperations({
|
|
152
|
-
entity: entities.models,
|
|
153
|
-
elasticsearch
|
|
154
|
-
}),
|
|
155
|
-
entries
|
|
156
|
-
};
|
|
30
|
+
const createOpenSearchStorageOperations = (params)=>{
|
|
31
|
+
const { table, esTable, documentClient, elasticsearch, plugins, container } = params;
|
|
32
|
+
const tableInstance = createTable({
|
|
33
|
+
name: table || process.env.DB_TABLE,
|
|
34
|
+
documentClient
|
|
35
|
+
});
|
|
36
|
+
const tableElasticsearchInstance = createOpenSearchTable({
|
|
37
|
+
name: esTable,
|
|
38
|
+
documentClient
|
|
39
|
+
});
|
|
40
|
+
const entities = {
|
|
41
|
+
groups: createGroupEntity({
|
|
42
|
+
entityName: ENTITIES.GROUPS,
|
|
43
|
+
table: tableInstance
|
|
44
|
+
}),
|
|
45
|
+
models: createModelEntity({
|
|
46
|
+
entityName: ENTITIES.MODELS,
|
|
47
|
+
table: tableInstance
|
|
48
|
+
}),
|
|
49
|
+
entries: createEntryEntity({
|
|
50
|
+
entityName: ENTITIES.ENTRIES,
|
|
51
|
+
table: tableInstance
|
|
52
|
+
}),
|
|
53
|
+
entriesEs: createOpenSearchEntity({
|
|
54
|
+
entityName: ENTITIES.ENTRIES_ES,
|
|
55
|
+
table: tableElasticsearchInstance
|
|
56
|
+
})
|
|
57
|
+
};
|
|
58
|
+
const fieldRegistry = container.resolve(CmsModelFieldToGraphQLRegistry);
|
|
59
|
+
const fieldIndexRegistry = container.resolve(CmsEntryOpenSearchFieldIndexRegistry);
|
|
60
|
+
const compressionHandler = container.resolve(CompressionHandler);
|
|
61
|
+
const bodyModifiers = container.resolveAll(CmsEntryOpenSearchBodyModifier);
|
|
62
|
+
const sortModifiers = container.resolveAll(CmsEntryOpenSearchSortModifier);
|
|
63
|
+
const queryModifiers = container.resolveAll(CmsEntryOpenSearchQueryModifier);
|
|
64
|
+
const valueSearchRegistry = container.resolve(CmsEntryOpenSearchValueSearchRegistry);
|
|
65
|
+
const fullTextSearches = container.resolveAll(CmsEntryOpenSearchFullTextSearch);
|
|
66
|
+
const valuesModifiers = container.resolveAll(CmsEntryOpenSearchValuesModifier);
|
|
67
|
+
const filterRegistry = container.resolve(CmsEntryOpenSearchFilterRegistry);
|
|
68
|
+
container.registerFactory(ModelAfterCreateEventHandler, ()=>({
|
|
69
|
+
async handle (event) {
|
|
70
|
+
const { model } = event.payload;
|
|
71
|
+
await createElasticsearchIndex({
|
|
72
|
+
client: elasticsearch,
|
|
73
|
+
model,
|
|
74
|
+
indexConfigs: container.resolveAll(CmsEntryOpenSearchIndex)
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}));
|
|
78
|
+
container.registerFactory(ModelAfterCreateFromEventHandler, ()=>({
|
|
79
|
+
async handle (event) {
|
|
80
|
+
const { model } = event.payload;
|
|
81
|
+
await createElasticsearchIndex({
|
|
82
|
+
client: elasticsearch,
|
|
83
|
+
model,
|
|
84
|
+
indexConfigs: container.resolveAll(CmsEntryOpenSearchIndex)
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}));
|
|
88
|
+
container.registerFactory(ModelAfterDeleteEventHandler, ()=>({
|
|
89
|
+
async handle (event) {
|
|
90
|
+
const { model } = event.payload;
|
|
91
|
+
await deleteElasticsearchIndex({
|
|
92
|
+
client: elasticsearch,
|
|
93
|
+
model
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}));
|
|
97
|
+
const entries = createEntriesStorageOperations({
|
|
98
|
+
entity: entities.entries,
|
|
99
|
+
esEntity: entities.entriesEs,
|
|
100
|
+
plugins,
|
|
101
|
+
elasticsearch,
|
|
102
|
+
fieldRegistry,
|
|
103
|
+
fieldIndexRegistry,
|
|
104
|
+
compressionHandler,
|
|
105
|
+
bodyModifiers,
|
|
106
|
+
sortModifiers,
|
|
107
|
+
queryModifiers,
|
|
108
|
+
valueSearchRegistry,
|
|
109
|
+
fullTextSearches,
|
|
110
|
+
valuesModifiers,
|
|
111
|
+
filterRegistry
|
|
112
|
+
});
|
|
113
|
+
return {
|
|
114
|
+
name: "dynamodb:opensearch",
|
|
115
|
+
beforeInit: async (context)=>{
|
|
116
|
+
context.db.registry.register({
|
|
117
|
+
item: entities.entries,
|
|
118
|
+
app: "cms",
|
|
119
|
+
tags: [
|
|
120
|
+
"regular",
|
|
121
|
+
entities.entries.name
|
|
122
|
+
]
|
|
123
|
+
});
|
|
124
|
+
context.db.registry.register({
|
|
125
|
+
item: entities.entriesEs,
|
|
126
|
+
app: "cms",
|
|
127
|
+
tags: [
|
|
128
|
+
"es",
|
|
129
|
+
entities.entriesEs.name
|
|
130
|
+
]
|
|
131
|
+
});
|
|
132
|
+
createCreateIndexTask(context);
|
|
133
|
+
entries.dataLoaders.clearAll();
|
|
134
|
+
},
|
|
135
|
+
getEntities: ()=>entities,
|
|
136
|
+
getTable: ()=>tableInstance,
|
|
137
|
+
getEsTable: ()=>tableElasticsearchInstance,
|
|
138
|
+
groups: createGroupsStorageOperations({
|
|
139
|
+
entity: entities.groups,
|
|
140
|
+
container
|
|
141
|
+
}),
|
|
142
|
+
models: createModelsStorageOperations({
|
|
143
|
+
entity: entities.models,
|
|
144
|
+
elasticsearch
|
|
145
|
+
}),
|
|
146
|
+
entries
|
|
147
|
+
};
|
|
157
148
|
};
|
|
158
149
|
class OpenSearchStorageOperationsFactoryImpl {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
150
|
+
async create(context) {
|
|
151
|
+
return createOpenSearchStorageOperations({
|
|
152
|
+
documentClient: context.db.driver.getClient(),
|
|
153
|
+
elasticsearch: context.opensearch,
|
|
154
|
+
plugins: context.plugins,
|
|
155
|
+
container: context.container
|
|
156
|
+
});
|
|
157
|
+
}
|
|
167
158
|
}
|
|
168
|
-
const OpenSearchStorageOperationsFactory =
|
|
169
|
-
|
|
170
|
-
|
|
159
|
+
const OpenSearchStorageOperationsFactory = StorageOperationsFactory.createImplementation({
|
|
160
|
+
implementation: OpenSearchStorageOperationsFactoryImpl,
|
|
161
|
+
dependencies: []
|
|
171
162
|
});
|
|
172
163
|
const storageOperationsFeature = createFeature({
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
164
|
+
name: "cms.storageOperations.openSearch",
|
|
165
|
+
register: (container)=>{
|
|
166
|
+
CmsEntryOpenSearchFieldIndexFeature.register(container);
|
|
167
|
+
CmsEntryOpenSearchFilterFeature.register(container);
|
|
168
|
+
CmsEntryOpenSearchIndexFeature.register(container);
|
|
169
|
+
CmsEntryOpenSearchValueSearchFeature.register(container);
|
|
170
|
+
container.register(OpenSearchStorageOperationsFactory).inSingletonScope();
|
|
171
|
+
}
|
|
181
172
|
});
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
};
|
|
173
|
+
const registerCmsOpenSearchStorageOperations = ()=>[
|
|
174
|
+
registerExtension(),
|
|
175
|
+
createRegisterExtensionPlugin((context)=>storageOperationsFeature.register(context.container))
|
|
176
|
+
];
|
|
177
|
+
export { registerCmsOpenSearchStorageOperations };
|
|
187
178
|
|
|
188
179
|
//# sourceMappingURL=feature.js.map
|
package/feature.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createTable","registerExtension","registerDynamoDbExtension","StorageOperationsFactory","StorageOperationsFactoryAbstraction","ENTITIES","createRegisterExtensionPlugin","createFeature","CmsEntryOpenSearchValueSearchFeature","CmsEntryOpenSearchValueSearchRegistry","CmsEntryOpenSearchIndex","CmsEntryOpenSearchIndexFeature","createModelsStorageOperations","createEntriesStorageOperations","createGroupEntity","createModelEntity","createEntryEntity","createElasticsearchIndex","createGroupsStorageOperations","createOpenSearchEntity","createOpenSearchTable","deleteElasticsearchIndex","createCreateIndexTask","ModelAfterCreateEventHandler","ModelAfterCreateFromEventHandler","ModelAfterDeleteEventHandler","CmsModelFieldToGraphQLRegistry","CompressionHandler","CmsEntryOpenSearchBodyModifier","CmsEntryOpenSearchSortModifier","CmsEntryOpenSearchQueryModifier","CmsEntryOpenSearchFullTextSearch","CmsEntryOpenSearchValuesModifier","CmsEntryOpenSearchFieldIndexFeature","CmsEntryOpenSearchFieldIndexRegistry","CmsEntryOpenSearchFilterFeature","CmsEntryOpenSearchFilterRegistry","createOpenSearchStorageOperations","params","table","esTable","documentClient","elasticsearch","plugins","container","tableInstance","name","process","env","DB_TABLE","tableElasticsearchInstance","entities","groups","entityName","GROUPS","models","MODELS","entries","ENTRIES","entriesEs","ENTRIES_ES","fieldRegistry","resolve","fieldIndexRegistry","compressionHandler","bodyModifiers","resolveAll","sortModifiers","queryModifiers","valueSearchRegistry","fullTextSearches","valuesModifiers","filterRegistry","registerFactory","handle","event","model","payload","client","indexConfigs","entity","esEntity","beforeInit","context","db","registry","register","item","app","tags","dataLoaders","clearAll","getEntities","getTable","getEsTable","OpenSearchStorageOperationsFactoryImpl","create","driver","getClient","opensearch","OpenSearchStorageOperationsFactory","createImplementation","implementation","dependencies","storageOperationsFeature","inSingletonScope","registerCmsOpenSearchStorageOperations"],"sources":["feature.ts"],"sourcesContent":["import { createTable, registerExtension as registerDynamoDbExtension } from \"@webiny/db-dynamodb\";\nimport { StorageOperationsFactory as StorageOperationsFactoryAbstraction } from \"@webiny/api-headless-cms/exports/api/cms/storage.js\";\nimport type { CmsContext, StorageOperationsFactory as IStorageOperationsFactory } from \"~/types.js\";\nimport { ENTITIES } from \"~/types.js\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport { createRegisterExtensionPlugin } from \"@webiny/handler\";\nimport { createFeature } from \"@webiny/feature/api/index.js\";\nimport {\n CmsEntryOpenSearchValueSearchFeature,\n CmsEntryOpenSearchValueSearchRegistry\n} from \"~/features/CmsEntryOpenSearchValueSearch/index.js\";\nimport {\n CmsEntryOpenSearchIndex,\n CmsEntryOpenSearchIndexFeature\n} from \"~/features/CmsEntryOpenSearchIndex/index.js\";\nimport { createModelsStorageOperations } from \"./operations/model/index.js\";\nimport { createEntriesStorageOperations } from \"./operations/entry/index.js\";\nimport { createGroupEntity } from \"~/definitions/group.js\";\nimport { createModelEntity } from \"~/definitions/model.js\";\nimport { createEntryEntity } from \"~/definitions/entry.js\";\nimport { createElasticsearchIndex } from \"~/elasticsearch/createElasticsearchIndex.js\";\nimport { createGroupsStorageOperations } from \"~/operations/group/index.js\";\nimport { createOpenSearchEntity, createOpenSearchTable } from \"@webiny/api-opensearch\";\nimport { deleteElasticsearchIndex } from \"./elasticsearch/deleteElasticsearchIndex.js\";\nimport { createCreateIndexTask } from \"~/tasks/createIndexTaskPlugin.js\";\nimport { ModelAfterCreateEventHandler } from \"@webiny/api-headless-cms/features/contentModel/CreateModel/index.js\";\nimport { ModelAfterCreateFromEventHandler } from \"@webiny/api-headless-cms/features/contentModel/CreateModelFrom/events.js\";\nimport { ModelAfterDeleteEventHandler } from \"@webiny/api-headless-cms/features/contentModel/DeleteModel/events.js\";\nimport { CmsModelFieldToGraphQLRegistry } from \"@webiny/api-headless-cms/exports/api/cms/graphql.js\";\nimport { CompressionHandler } from \"@webiny/utils/exports/api.js\";\nimport { CmsEntryOpenSearchBodyModifier } from \"~/features/CmsEntryOpenSearchBodyModifier/index.js\";\nimport { CmsEntryOpenSearchSortModifier } from \"~/features/CmsEntryOpenSearchSortModifier/index.js\";\nimport { CmsEntryOpenSearchQueryModifier } from \"~/features/CmsEntryOpenSearchQueryModifier/index.js\";\nimport { CmsEntryOpenSearchFullTextSearch } from \"~/features/CmsEntryOpenSearchFullTextSearch/index.js\";\nimport { CmsEntryOpenSearchValuesModifier } from \"~/features/CmsEntryOpenSearchValuesModifier/index.js\";\nimport {\n CmsEntryOpenSearchFieldIndexFeature,\n CmsEntryOpenSearchFieldIndexRegistry\n} from \"~/features/CmsEntryOpenSearchFieldIndex/index.js\";\nimport {\n CmsEntryOpenSearchFilterFeature,\n CmsEntryOpenSearchFilterRegistry\n} from \"~/features/CmsEntryOpenSearchFilter/index.js\";\n\nconst createOpenSearchStorageOperations: IStorageOperationsFactory = params => {\n const { table, esTable, documentClient, elasticsearch, plugins, container } = params;\n\n const tableInstance = createTable({\n name: table || (process.env.DB_TABLE as string),\n documentClient\n });\n const tableElasticsearchInstance = createOpenSearchTable({\n name: esTable,\n documentClient\n });\n\n const entities = {\n groups: createGroupEntity({\n entityName: ENTITIES.GROUPS,\n table: tableInstance\n }),\n models: createModelEntity({\n entityName: ENTITIES.MODELS,\n table: tableInstance\n }),\n entries: createEntryEntity({\n entityName: ENTITIES.ENTRIES,\n table: tableInstance\n }),\n entriesEs: createOpenSearchEntity({\n entityName: ENTITIES.ENTRIES_ES,\n table: tableElasticsearchInstance\n })\n };\n\n const fieldRegistry = container.resolve(CmsModelFieldToGraphQLRegistry);\n const fieldIndexRegistry = container.resolve(CmsEntryOpenSearchFieldIndexRegistry);\n const compressionHandler = container.resolve(CompressionHandler);\n const bodyModifiers = container.resolveAll(CmsEntryOpenSearchBodyModifier);\n const sortModifiers = container.resolveAll(CmsEntryOpenSearchSortModifier);\n const queryModifiers = container.resolveAll(CmsEntryOpenSearchQueryModifier);\n const valueSearchRegistry = container.resolve(CmsEntryOpenSearchValueSearchRegistry);\n const fullTextSearches = container.resolveAll(CmsEntryOpenSearchFullTextSearch);\n const valuesModifiers = container.resolveAll(CmsEntryOpenSearchValuesModifier);\n const filterRegistry = container.resolve(CmsEntryOpenSearchFilterRegistry);\n\n container.registerFactory(ModelAfterCreateEventHandler, () => ({\n async handle(event) {\n const { model } = event.payload;\n await createElasticsearchIndex({\n client: elasticsearch,\n model,\n indexConfigs: container.resolveAll(CmsEntryOpenSearchIndex)\n });\n }\n }));\n\n container.registerFactory(ModelAfterCreateFromEventHandler, () => ({\n async handle(event) {\n const { model } = event.payload;\n await createElasticsearchIndex({\n client: elasticsearch,\n model,\n indexConfigs: container.resolveAll(CmsEntryOpenSearchIndex)\n });\n }\n }));\n\n container.registerFactory(ModelAfterDeleteEventHandler, () => ({\n async handle(event) {\n const { model } = event.payload;\n await deleteElasticsearchIndex({\n client: elasticsearch,\n model\n });\n }\n }));\n\n const entries = createEntriesStorageOperations({\n entity: entities.entries,\n esEntity: entities.entriesEs,\n plugins,\n elasticsearch,\n fieldRegistry,\n fieldIndexRegistry,\n compressionHandler,\n bodyModifiers,\n sortModifiers,\n queryModifiers,\n valueSearchRegistry,\n fullTextSearches,\n valuesModifiers,\n filterRegistry\n });\n\n return {\n name: \"dynamodb:opensearch\",\n beforeInit: async context => {\n context.db.registry.register({\n item: entities.entries,\n app: \"cms\",\n tags: [\"regular\", entities.entries.name]\n });\n context.db.registry.register({\n item: entities.entriesEs,\n app: \"cms\",\n tags: [\"es\", entities.entriesEs.name]\n });\n // TODO we know that context is ok, but types are missing elasticsearch/opensearch\n // @ts-expect-error\n createCreateIndexTask(context);\n\n entries.dataLoaders.clearAll();\n },\n getEntities: () => entities,\n getTable: () => tableInstance,\n getEsTable: () => tableElasticsearchInstance,\n groups: createGroupsStorageOperations({\n entity: entities.groups,\n container\n }),\n models: createModelsStorageOperations({\n entity: entities.models,\n elasticsearch\n }),\n entries\n };\n};\n\nclass OpenSearchStorageOperationsFactoryImpl\n implements StorageOperationsFactoryAbstraction.Interface\n{\n public async create(context: CmsContext) {\n return createOpenSearchStorageOperations({\n documentClient: context.db.driver.getClient() as DynamoDBDocument,\n elasticsearch: context.opensearch,\n plugins: context.plugins,\n container: context.container\n });\n }\n}\n\nconst OpenSearchStorageOperationsFactory = StorageOperationsFactoryAbstraction.createImplementation(\n {\n implementation: OpenSearchStorageOperationsFactoryImpl,\n dependencies: []\n }\n);\n\nconst storageOperationsFeature = createFeature({\n name: \"cms.storageOperations.openSearch\",\n register: container => {\n CmsEntryOpenSearchFieldIndexFeature.register(container);\n CmsEntryOpenSearchFilterFeature.register(container);\n CmsEntryOpenSearchIndexFeature.register(container);\n CmsEntryOpenSearchValueSearchFeature.register(container);\n container.register(OpenSearchStorageOperationsFactory).inSingletonScope();\n }\n});\n\nexport const registerCmsOpenSearchStorageOperations = () => {\n return [\n registerDynamoDbExtension(),\n createRegisterExtensionPlugin(context => {\n return storageOperationsFeature.register(context.container);\n })\n ];\n};\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,iBAAiB,IAAIC,yBAAyB,QAAQ,qBAAqB;AACjG,SAASC,wBAAwB,IAAIC,mCAAmC,QAAQ,qDAAqD;AAErI,SAASC,QAAQ;AAEjB,SAASC,6BAA6B,QAAQ,iBAAiB;AAC/D,SAASC,aAAa,QAAQ,8BAA8B;AAC5D,SACIC,oCAAoC,EACpCC,qCAAqC;AAEzC,SACIC,uBAAuB,EACvBC,8BAA8B;AAElC,SAASC,6BAA6B;AACtC,SAASC,8BAA8B;AACvC,SAASC,iBAAiB;AAC1B,SAASC,iBAAiB;AAC1B,SAASC,iBAAiB;AAC1B,SAASC,wBAAwB;AACjC,SAASC,6BAA6B;AACtC,SAASC,sBAAsB,EAAEC,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AAC2E,QAAQ,CAAC1C,SAAS,CAAC;IAClDpC,oCAAoC,CAAC8E,QAAQ,CAAC1C,SAAS,CAAC;IACxDA,SAAS,CAAC0C,QAAQ,CAACc,kCAAkC,CAAC,CAACK,gBAAgB,CAAC,CAAC;EAC7E;AACJ,CAAC,CAAC;AAEF,OAAO,MAAMC,sCAAsC,GAAGA,CAAA,KAAM;EACxD,OAAO,CACHxG,yBAAyB,CAAC,CAAC,EAC3BI,6BAA6B,CAAC6E,OAAO,IAAI;IACrC,OAAOqB,wBAAwB,CAAClB,QAAQ,CAACH,OAAO,CAACvC,SAAS,CAAC;EAC/D,CAAC,CAAC,CACL;AACL,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"feature.js","sources":["../src/feature.ts"],"sourcesContent":["import { createTable, registerExtension as registerDynamoDbExtension } from \"@webiny/db-dynamodb\";\nimport { StorageOperationsFactory as StorageOperationsFactoryAbstraction } from \"@webiny/api-headless-cms/exports/api/cms/storage.js\";\nimport type { CmsContext, StorageOperationsFactory as IStorageOperationsFactory } from \"~/types.js\";\nimport { ENTITIES } from \"~/types.js\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport { createRegisterExtensionPlugin } from \"@webiny/handler\";\nimport { createFeature } from \"@webiny/feature/api/index.js\";\nimport {\n CmsEntryOpenSearchValueSearchFeature,\n CmsEntryOpenSearchValueSearchRegistry\n} from \"~/features/CmsEntryOpenSearchValueSearch/index.js\";\nimport {\n CmsEntryOpenSearchIndex,\n CmsEntryOpenSearchIndexFeature\n} from \"~/features/CmsEntryOpenSearchIndex/index.js\";\nimport { createModelsStorageOperations } from \"./operations/model/index.js\";\nimport { createEntriesStorageOperations } from \"./operations/entry/index.js\";\nimport { createGroupEntity } from \"~/definitions/group.js\";\nimport { createModelEntity } from \"~/definitions/model.js\";\nimport { createEntryEntity } from \"~/definitions/entry.js\";\nimport { createElasticsearchIndex } from \"~/elasticsearch/createElasticsearchIndex.js\";\nimport { createGroupsStorageOperations } from \"~/operations/group/index.js\";\nimport { createOpenSearchEntity, createOpenSearchTable } from \"@webiny/api-opensearch\";\nimport { deleteElasticsearchIndex } from \"./elasticsearch/deleteElasticsearchIndex.js\";\nimport { createCreateIndexTask } from \"~/tasks/createIndexTaskPlugin.js\";\nimport { ModelAfterCreateEventHandler } from \"@webiny/api-headless-cms/features/contentModel/CreateModel/index.js\";\nimport { ModelAfterCreateFromEventHandler } from \"@webiny/api-headless-cms/features/contentModel/CreateModelFrom/events.js\";\nimport { ModelAfterDeleteEventHandler } from \"@webiny/api-headless-cms/features/contentModel/DeleteModel/events.js\";\nimport { CmsModelFieldToGraphQLRegistry } from \"@webiny/api-headless-cms/exports/api/cms/graphql.js\";\nimport { CompressionHandler } from \"@webiny/utils/exports/api.js\";\nimport { CmsEntryOpenSearchBodyModifier } from \"~/features/CmsEntryOpenSearchBodyModifier/index.js\";\nimport { CmsEntryOpenSearchSortModifier } from \"~/features/CmsEntryOpenSearchSortModifier/index.js\";\nimport { CmsEntryOpenSearchQueryModifier } from \"~/features/CmsEntryOpenSearchQueryModifier/index.js\";\nimport { CmsEntryOpenSearchFullTextSearch } from \"~/features/CmsEntryOpenSearchFullTextSearch/index.js\";\nimport { CmsEntryOpenSearchValuesModifier } from \"~/features/CmsEntryOpenSearchValuesModifier/index.js\";\nimport {\n CmsEntryOpenSearchFieldIndexFeature,\n CmsEntryOpenSearchFieldIndexRegistry\n} from \"~/features/CmsEntryOpenSearchFieldIndex/index.js\";\nimport {\n CmsEntryOpenSearchFilterFeature,\n CmsEntryOpenSearchFilterRegistry\n} from \"~/features/CmsEntryOpenSearchFilter/index.js\";\n\nconst createOpenSearchStorageOperations: IStorageOperationsFactory = params => {\n const { table, esTable, documentClient, elasticsearch, plugins, container } = params;\n\n const tableInstance = createTable({\n name: table || (process.env.DB_TABLE as string),\n documentClient\n });\n const tableElasticsearchInstance = createOpenSearchTable({\n name: esTable,\n documentClient\n });\n\n const entities = {\n groups: createGroupEntity({\n entityName: ENTITIES.GROUPS,\n table: tableInstance\n }),\n models: createModelEntity({\n entityName: ENTITIES.MODELS,\n table: tableInstance\n }),\n entries: createEntryEntity({\n entityName: ENTITIES.ENTRIES,\n table: tableInstance\n }),\n entriesEs: createOpenSearchEntity({\n entityName: ENTITIES.ENTRIES_ES,\n table: tableElasticsearchInstance\n })\n };\n\n const fieldRegistry = container.resolve(CmsModelFieldToGraphQLRegistry);\n const fieldIndexRegistry = container.resolve(CmsEntryOpenSearchFieldIndexRegistry);\n const compressionHandler = container.resolve(CompressionHandler);\n const bodyModifiers = container.resolveAll(CmsEntryOpenSearchBodyModifier);\n const sortModifiers = container.resolveAll(CmsEntryOpenSearchSortModifier);\n const queryModifiers = container.resolveAll(CmsEntryOpenSearchQueryModifier);\n const valueSearchRegistry = container.resolve(CmsEntryOpenSearchValueSearchRegistry);\n const fullTextSearches = container.resolveAll(CmsEntryOpenSearchFullTextSearch);\n const valuesModifiers = container.resolveAll(CmsEntryOpenSearchValuesModifier);\n const filterRegistry = container.resolve(CmsEntryOpenSearchFilterRegistry);\n\n container.registerFactory(ModelAfterCreateEventHandler, () => ({\n async handle(event) {\n const { model } = event.payload;\n await createElasticsearchIndex({\n client: elasticsearch,\n model,\n indexConfigs: container.resolveAll(CmsEntryOpenSearchIndex)\n });\n }\n }));\n\n container.registerFactory(ModelAfterCreateFromEventHandler, () => ({\n async handle(event) {\n const { model } = event.payload;\n await createElasticsearchIndex({\n client: elasticsearch,\n model,\n indexConfigs: container.resolveAll(CmsEntryOpenSearchIndex)\n });\n }\n }));\n\n container.registerFactory(ModelAfterDeleteEventHandler, () => ({\n async handle(event) {\n const { model } = event.payload;\n await deleteElasticsearchIndex({\n client: elasticsearch,\n model\n });\n }\n }));\n\n const entries = createEntriesStorageOperations({\n entity: entities.entries,\n esEntity: entities.entriesEs,\n plugins,\n elasticsearch,\n fieldRegistry,\n fieldIndexRegistry,\n compressionHandler,\n bodyModifiers,\n sortModifiers,\n queryModifiers,\n valueSearchRegistry,\n fullTextSearches,\n valuesModifiers,\n filterRegistry\n });\n\n return {\n name: \"dynamodb:opensearch\",\n beforeInit: async context => {\n context.db.registry.register({\n item: entities.entries,\n app: \"cms\",\n tags: [\"regular\", entities.entries.name]\n });\n context.db.registry.register({\n item: entities.entriesEs,\n app: \"cms\",\n tags: [\"es\", entities.entriesEs.name]\n });\n // TODO we know that context is ok, but types are missing elasticsearch/opensearch\n // @ts-expect-error\n createCreateIndexTask(context);\n\n entries.dataLoaders.clearAll();\n },\n getEntities: () => entities,\n getTable: () => tableInstance,\n getEsTable: () => tableElasticsearchInstance,\n groups: createGroupsStorageOperations({\n entity: entities.groups,\n container\n }),\n models: createModelsStorageOperations({\n entity: entities.models,\n elasticsearch\n }),\n entries\n };\n};\n\nclass OpenSearchStorageOperationsFactoryImpl\n implements StorageOperationsFactoryAbstraction.Interface\n{\n public async create(context: CmsContext) {\n return createOpenSearchStorageOperations({\n documentClient: context.db.driver.getClient() as DynamoDBDocument,\n elasticsearch: context.opensearch,\n plugins: context.plugins,\n container: context.container\n });\n }\n}\n\nconst OpenSearchStorageOperationsFactory = StorageOperationsFactoryAbstraction.createImplementation(\n {\n implementation: OpenSearchStorageOperationsFactoryImpl,\n dependencies: []\n }\n);\n\nconst storageOperationsFeature = createFeature({\n name: \"cms.storageOperations.openSearch\",\n register: container => {\n CmsEntryOpenSearchFieldIndexFeature.register(container);\n CmsEntryOpenSearchFilterFeature.register(container);\n CmsEntryOpenSearchIndexFeature.register(container);\n CmsEntryOpenSearchValueSearchFeature.register(container);\n container.register(OpenSearchStorageOperationsFactory).inSingletonScope();\n }\n});\n\nexport const registerCmsOpenSearchStorageOperations = () => {\n return [\n registerDynamoDbExtension(),\n createRegisterExtensionPlugin(context => {\n return storageOperationsFeature.register(context.container);\n })\n ];\n};\n"],"names":["createOpenSearchStorageOperations","params","table","esTable","documentClient","elasticsearch","plugins","container","tableInstance","createTable","process","tableElasticsearchInstance","createOpenSearchTable","entities","createGroupEntity","ENTITIES","createModelEntity","createEntryEntity","createOpenSearchEntity","fieldRegistry","CmsModelFieldToGraphQLRegistry","fieldIndexRegistry","CmsEntryOpenSearchFieldIndexRegistry","compressionHandler","CompressionHandler","bodyModifiers","CmsEntryOpenSearchBodyModifier","sortModifiers","CmsEntryOpenSearchSortModifier","queryModifiers","CmsEntryOpenSearchQueryModifier","valueSearchRegistry","CmsEntryOpenSearchValueSearchRegistry","fullTextSearches","CmsEntryOpenSearchFullTextSearch","valuesModifiers","CmsEntryOpenSearchValuesModifier","filterRegistry","CmsEntryOpenSearchFilterRegistry","ModelAfterCreateEventHandler","event","model","createElasticsearchIndex","CmsEntryOpenSearchIndex","ModelAfterCreateFromEventHandler","ModelAfterDeleteEventHandler","deleteElasticsearchIndex","entries","createEntriesStorageOperations","context","createCreateIndexTask","createGroupsStorageOperations","createModelsStorageOperations","OpenSearchStorageOperationsFactoryImpl","OpenSearchStorageOperationsFactory","StorageOperationsFactoryAbstraction","storageOperationsFeature","createFeature","CmsEntryOpenSearchFieldIndexFeature","CmsEntryOpenSearchFilterFeature","CmsEntryOpenSearchIndexFeature","CmsEntryOpenSearchValueSearchFeature","registerCmsOpenSearchStorageOperations","registerDynamoDbExtension","createRegisterExtensionPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,MAAMA,oCAA+DC,CAAAA;IACjE,MAAM,EAAEC,KAAK,EAAEC,OAAO,EAAEC,cAAc,EAAEC,aAAa,EAAEC,OAAO,EAAEC,SAAS,EAAE,GAAGN;IAE9E,MAAMO,gBAAgBC,YAAY;QAC9B,MAAMP,SAAUQ,QAAQ,GAAG,CAAC,QAAQ;QACpCN;IACJ;IACA,MAAMO,6BAA6BC,sBAAsB;QACrD,MAAMT;QACNC;IACJ;IAEA,MAAMS,WAAW;QACb,QAAQC,kBAAkB;YACtB,YAAYC,SAAS,MAAM;YAC3B,OAAOP;QACX;QACA,QAAQQ,kBAAkB;YACtB,YAAYD,SAAS,MAAM;YAC3B,OA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xCsD,qCAAqC,QAAQ,CAACtD;QAC9CA,UAAU,QAAQ,CAAC+C,oCAAoC,gBAAgB;IAC3E;AACJ;AAEO,MAAMQ,yCAAyC,IAC3C;QACHC;QACAC,8BAA8Bf,CAAAA,UACnBO,yBAAyB,QAAQ,CAACP,QAAQ,SAAS;KAEjE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
-
|
|
2
|
+
const CmsEntryOpenSearchBodyModifier = createAbstraction("Cms/Entry/OpenSearch/BodyModifier");
|
|
3
|
+
export { CmsEntryOpenSearchBodyModifier };
|
|
3
4
|
|
|
4
5
|
//# sourceMappingURL=abstractions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/CmsEntryOpenSearchBodyModifier/abstractions.js","sources":["../../../src/features/CmsEntryOpenSearchBodyModifier/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { SearchBody } from \"@webiny/api-opensearch\";\n\nexport interface ModifyBodyParams {\n body: SearchBody;\n model: CmsModel;\n where: Record<string, any>;\n}\n\nexport interface ICmsEntryOpenSearchBodyModifier {\n readonly modelId?: string;\n modifyBody(params: ModifyBodyParams): void;\n}\n\nexport const CmsEntryOpenSearchBodyModifier = createAbstraction<ICmsEntryOpenSearchBodyModifier>(\n \"Cms/Entry/OpenSearch/BodyModifier\"\n);\n\nexport namespace CmsEntryOpenSearchBodyModifier {\n export type Interface = ICmsEntryOpenSearchBodyModifier;\n export type Params = ModifyBodyParams;\n}\n"],"names":["CmsEntryOpenSearchBodyModifier","createAbstraction"],"mappings":";AAeO,MAAMA,iCAAiCC,kBAC1C"}
|
|
@@ -1,36 +1,37 @@
|
|
|
1
|
-
import { CmsEntryOpenSearchFieldIndexRegistry
|
|
1
|
+
import { CmsEntryOpenSearchFieldIndexRegistry } from "./abstractions/CmsEntryOpenSearchFieldIndexRegistry.js";
|
|
2
2
|
import { CmsEntryOpenSearchFieldIndex } from "./abstractions/CmsEntryOpenSearchFieldIndex.js";
|
|
3
3
|
import { getBaseFieldType } from "@webiny/api-headless-cms/utils/getBaseFieldType.js";
|
|
4
4
|
import { FIELD_INDEXING_DEFAULT } from "./constants.js";
|
|
5
5
|
class CmsEntryOpenSearchFieldIndexRegistryImpl {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
constructor(fieldIndexing){
|
|
7
|
+
this.fieldIndexing = fieldIndexing;
|
|
8
|
+
}
|
|
9
|
+
get(type) {
|
|
10
|
+
const fieldType = getBaseFieldType({
|
|
11
|
+
type
|
|
12
|
+
});
|
|
13
|
+
return this.fieldIndexing.find((field)=>field.fieldType === fieldType);
|
|
14
|
+
}
|
|
15
|
+
getDefault() {
|
|
16
|
+
const fieldIndex = this.fieldIndexing.find((field)=>field.fieldType === FIELD_INDEXING_DEFAULT);
|
|
17
|
+
if (fieldIndex) return fieldIndex;
|
|
18
|
+
throw new Error(`Missing default field index plugin. Please make sure to register a plugin with "${FIELD_INDEXING_DEFAULT}" field type.`);
|
|
19
|
+
}
|
|
20
|
+
getAll() {
|
|
21
|
+
return this.fieldIndexing;
|
|
19
22
|
}
|
|
20
|
-
/**
|
|
21
|
-
* This should never happen, as the default field index plugin exists in our code. This can fail during testing.
|
|
22
|
-
*/
|
|
23
|
-
throw new Error(`Missing default field index plugin. Please make sure to register a plugin with "${FIELD_INDEXING_DEFAULT}" field type.`);
|
|
24
|
-
}
|
|
25
|
-
getAll() {
|
|
26
|
-
return this.fieldIndexing;
|
|
27
|
-
}
|
|
28
23
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
const CmsEntryOpenSearchFieldIndexRegistry_CmsEntryOpenSearchFieldIndexRegistry = CmsEntryOpenSearchFieldIndexRegistry.createImplementation({
|
|
25
|
+
implementation: CmsEntryOpenSearchFieldIndexRegistryImpl,
|
|
26
|
+
dependencies: [
|
|
27
|
+
[
|
|
28
|
+
CmsEntryOpenSearchFieldIndex,
|
|
29
|
+
{
|
|
30
|
+
multiple: true
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
]
|
|
34
34
|
});
|
|
35
|
+
export { CmsEntryOpenSearchFieldIndexRegistry_CmsEntryOpenSearchFieldIndexRegistry as CmsEntryOpenSearchFieldIndexRegistry };
|
|
35
36
|
|
|
36
37
|
//# sourceMappingURL=CmsEntryOpenSearchFieldIndexRegistry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js","sources":["../../../src/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.ts"],"sourcesContent":["import { CmsEntryOpenSearchFieldIndexRegistry as Abstraction } from \"./abstractions/CmsEntryOpenSearchFieldIndexRegistry.js\";\nimport { CmsEntryOpenSearchFieldIndex } from \"./abstractions/CmsEntryOpenSearchFieldIndex.js\";\nimport { getBaseFieldType } from \"@webiny/api-headless-cms/utils/getBaseFieldType.js\";\nimport { FIELD_INDEXING_DEFAULT } from \"./constants.js\";\n\nclass CmsEntryOpenSearchFieldIndexRegistryImpl implements Abstraction.Interface {\n public constructor(private readonly fieldIndexing: CmsEntryOpenSearchFieldIndex.Interface[]) {}\n\n public get(type: string): CmsEntryOpenSearchFieldIndex.Interface | undefined {\n const fieldType = getBaseFieldType({\n type\n });\n return this.fieldIndexing.find(field => field.fieldType === fieldType);\n }\n\n public getDefault(): CmsEntryOpenSearchFieldIndex.Interface {\n const fieldIndex = this.fieldIndexing.find(\n field => field.fieldType === FIELD_INDEXING_DEFAULT\n );\n if (fieldIndex) {\n return fieldIndex;\n }\n /**\n * This should never happen, as the default field index plugin exists in our code. This can fail during testing.\n */\n throw new Error(\n `Missing default field index plugin. Please make sure to register a plugin with \"${FIELD_INDEXING_DEFAULT}\" field type.`\n );\n }\n\n public getAll(): CmsEntryOpenSearchFieldIndex.Interface[] {\n return this.fieldIndexing;\n }\n}\n\nexport const CmsEntryOpenSearchFieldIndexRegistry = Abstraction.createImplementation({\n implementation: CmsEntryOpenSearchFieldIndexRegistryImpl,\n dependencies: [[CmsEntryOpenSearchFieldIndex, { multiple: true }]]\n});\n"],"names":["CmsEntryOpenSearchFieldIndexRegistryImpl","fieldIndexing","type","fieldType","getBaseFieldType","field","fieldIndex","FIELD_INDEXING_DEFAULT","Error","CmsEntryOpenSearchFieldIndexRegistry","Abstraction","CmsEntryOpenSearchFieldIndex"],"mappings":";;;;AAKA,MAAMA;IACF,YAAoCC,aAAuD,CAAE;aAAzDA,aAAa,GAAbA;IAA0D;IAEvF,IAAIC,IAAY,EAAsD;QACzE,MAAMC,YAAYC,iBAAiB;YAC/BF;QACJ;QACA,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAACG,CAAAA,QAASA,MAAM,SAAS,KAAKF;IAChE;IAEO,aAAqD;QACxD,MAAMG,aAAa,IAAI,CAAC,aAAa,CAAC,IAAI,CACtCD,CAAAA,QAASA,MAAM,SAAS,KAAKE;QAEjC,IAAID,YACA,OAAOA;QAKX,MAAM,IAAIE,MACN,CAAC,gFAAgF,EAAED,uBAAuB,aAAa,CAAC;IAEhI;IAEO,SAAmD;QACtD,OAAO,IAAI,CAAC,aAAa;IAC7B;AACJ;AAEO,MAAME,4EAAuCC,qCAAAA,oBAAgC,CAAC;IACjF,gBAAgBV;IAChB,cAAc;QAAC;YAACW;YAA8B;gBAAE,UAAU;YAAK;SAAE;KAAC;AACtE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
-
|
|
2
|
+
const CmsEntryOpenSearchFieldIndex = createAbstraction("Cms/Entry/OpenSearch/FieldIndex");
|
|
3
|
+
export { CmsEntryOpenSearchFieldIndex };
|
|
3
4
|
|
|
4
5
|
//# sourceMappingURL=CmsEntryOpenSearchFieldIndex.js.map
|
package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js","sources":["../../../../src/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { CmsModel, CmsModelField } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { CmsModelFieldToGraphQLRegistry } from \"@webiny/api-headless-cms/exports/api/cms/graphql.js\";\n\nexport interface ToIndexParams {\n model: CmsModel;\n field: CmsModelField;\n fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;\n value: any;\n rawValue: any;\n getFieldIndex(fieldType: string): ICmsEntryOpenSearchFieldIndex;\n}\n\nexport interface ToIndexValue {\n value?: any;\n rawValue?: any;\n}\n\nexport interface FromIndexParams {\n model: CmsModel;\n field: CmsModelField;\n fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;\n value: any;\n rawValue: any;\n getFieldIndex(fieldType: string): ICmsEntryOpenSearchFieldIndex;\n}\n\nexport interface ICmsEntryOpenSearchFieldIndex {\n readonly fieldType: string;\n unmappedType?(field: Pick<CmsModelField, \"fieldId\" | \"type\">): string;\n toIndex(params: ToIndexParams): ToIndexValue;\n fromIndex(params: FromIndexParams): any;\n}\n\nexport const CmsEntryOpenSearchFieldIndex = createAbstraction<ICmsEntryOpenSearchFieldIndex>(\n \"Cms/Entry/OpenSearch/FieldIndex\"\n);\n\nexport namespace CmsEntryOpenSearchFieldIndex {\n export type Interface = ICmsEntryOpenSearchFieldIndex;\n export type ToIndex = ToIndexParams;\n export type ToValue = ToIndexValue;\n export type FromIndex = FromIndexParams;\n}\n"],"names":["CmsEntryOpenSearchFieldIndex","createAbstraction"],"mappings":";AAkCO,MAAMA,+BAA+BC,kBACxC"}
|
package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
-
|
|
2
|
+
const CmsEntryOpenSearchFieldIndexRegistry = createAbstraction("Cms/Entry/OpenSearch/FieldIndexRegistry");
|
|
3
|
+
export { CmsEntryOpenSearchFieldIndexRegistry };
|
|
3
4
|
|
|
4
5
|
//# sourceMappingURL=CmsEntryOpenSearchFieldIndexRegistry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.js","sources":["../../../../src/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { CmsEntryOpenSearchFieldIndex } from \"./CmsEntryOpenSearchFieldIndex.js\";\n\nexport interface ICmsEntryOpenSearchFieldIndexRegistry {\n get(fieldType: string): CmsEntryOpenSearchFieldIndex.Interface | undefined;\n getDefault(): CmsEntryOpenSearchFieldIndex.Interface;\n getAll(): CmsEntryOpenSearchFieldIndex.Interface[];\n}\n\nexport const CmsEntryOpenSearchFieldIndexRegistry =\n createAbstraction<ICmsEntryOpenSearchFieldIndexRegistry>(\n \"Cms/Entry/OpenSearch/FieldIndexRegistry\"\n );\n\nexport namespace CmsEntryOpenSearchFieldIndexRegistry {\n export type Interface = ICmsEntryOpenSearchFieldIndexRegistry;\n export type FieldIndex = CmsEntryOpenSearchFieldIndex.Interface;\n}\n"],"names":["CmsEntryOpenSearchFieldIndexRegistry","createAbstraction"],"mappings":";AASO,MAAMA,uCACTC,kBACI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/CmsEntryOpenSearchFieldIndex/constants.js","sources":["../../../src/features/CmsEntryOpenSearchFieldIndex/constants.ts"],"sourcesContent":["export const FIELD_INDEXING_DEFAULT = \"*\" as const;\n"],"names":["FIELD_INDEXING_DEFAULT"],"mappings":"AAAO,MAAMA,yBAAyB"}
|
|
@@ -7,18 +7,19 @@ import { NumberFieldIndex } from "./fields/NumberFieldIndex.js";
|
|
|
7
7
|
import { DefaultFieldIndex } from "./fields/DefaultFieldIndex.js";
|
|
8
8
|
import { DateTimeFieldIndex } from "./fields/DateTimeFieldIndex.js";
|
|
9
9
|
import { ObjectFieldIndex } from "./fields/ObjectFieldIndex.js";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
10
|
+
const CmsEntryOpenSearchFieldIndexFeature = createFeature({
|
|
11
|
+
name: "Cms/Entry/OpenSearch/FieldIndexFeature",
|
|
12
|
+
register: (container)=>{
|
|
13
|
+
container.register(RichTextFieldIndex);
|
|
14
|
+
container.register(JsonFieldIndex);
|
|
15
|
+
container.register(LongTextFieldIndex);
|
|
16
|
+
container.register(NumberFieldIndex);
|
|
17
|
+
container.register(DefaultFieldIndex);
|
|
18
|
+
container.register(DateTimeFieldIndex);
|
|
19
|
+
container.register(ObjectFieldIndex);
|
|
20
|
+
container.register(CmsEntryOpenSearchFieldIndexRegistry);
|
|
21
|
+
}
|
|
22
22
|
});
|
|
23
|
+
export { CmsEntryOpenSearchFieldIndexFeature };
|
|
23
24
|
|
|
24
25
|
//# sourceMappingURL=feature.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/CmsEntryOpenSearchFieldIndex/feature.js","sources":["../../../src/features/CmsEntryOpenSearchFieldIndex/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { CmsEntryOpenSearchFieldIndexRegistry } from \"./CmsEntryOpenSearchFieldIndexRegistry.js\";\nimport { RichTextFieldIndex } from \"./fields/RichTextFieldIndex.js\";\nimport { JsonFieldIndex } from \"./fields/JsonFieldIndex.js\";\nimport { LongTextFieldIndex } from \"./fields/LongTextFieldIndex.js\";\nimport { NumberFieldIndex } from \"./fields/NumberFieldIndex.js\";\nimport { DefaultFieldIndex } from \"./fields/DefaultFieldIndex.js\";\nimport { DateTimeFieldIndex } from \"./fields/DateTimeFieldIndex.js\";\nimport { ObjectFieldIndex } from \"./fields/ObjectFieldIndex.js\";\n\nexport const CmsEntryOpenSearchFieldIndexFeature = createFeature({\n name: \"Cms/Entry/OpenSearch/FieldIndexFeature\",\n register: container => {\n container.register(RichTextFieldIndex);\n container.register(JsonFieldIndex);\n container.register(LongTextFieldIndex);\n container.register(NumberFieldIndex);\n container.register(DefaultFieldIndex);\n container.register(DateTimeFieldIndex);\n container.register(ObjectFieldIndex);\n container.register(CmsEntryOpenSearchFieldIndexRegistry);\n }\n});\n"],"names":["CmsEntryOpenSearchFieldIndexFeature","createFeature","container","RichTextFieldIndex","JsonFieldIndex","LongTextFieldIndex","NumberFieldIndex","DefaultFieldIndex","DateTimeFieldIndex","ObjectFieldIndex","CmsEntryOpenSearchFieldIndexRegistry"],"mappings":";;;;;;;;;AAUO,MAAMA,sCAAsCC,cAAc;IAC7D,MAAM;IACN,UAAUC,CAAAA;QACNA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;QACnBF,UAAU,QAAQ,CAACG;QACnBH,UAAU,QAAQ,CAACI;QACnBJ,UAAU,QAAQ,CAACK;QACnBL,UAAU,QAAQ,CAACM;QACnBN,UAAU,QAAQ,CAACO;QACnBP,UAAU,QAAQ,CAACQ;IACvB;AACJ"}
|