@webiny/api-headless-cms-ddb-es 0.0.0-ee-vpcs.549378cf03
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/LICENSE +21 -0
- package/README.md +35 -0
- package/configurations.d.ts +12 -0
- package/configurations.js +43 -0
- package/configurations.js.map +1 -0
- package/definitions/entry.d.ts +8 -0
- package/definitions/entry.js +90 -0
- package/definitions/entry.js.map +1 -0
- package/definitions/entryElasticsearch.d.ts +8 -0
- package/definitions/entryElasticsearch.js +42 -0
- package/definitions/entryElasticsearch.js.map +1 -0
- package/definitions/group.d.ts +8 -0
- package/definitions/group.js +70 -0
- package/definitions/group.js.map +1 -0
- package/definitions/model.d.ts +8 -0
- package/definitions/model.js +97 -0
- package/definitions/model.js.map +1 -0
- package/definitions/settings.d.ts +8 -0
- package/definitions/settings.js +58 -0
- package/definitions/settings.js.map +1 -0
- package/definitions/system.d.ts +8 -0
- package/definitions/system.js +46 -0
- package/definitions/system.js.map +1 -0
- package/definitions/table.d.ts +8 -0
- package/definitions/table.js +24 -0
- package/definitions/table.js.map +1 -0
- package/definitions/tableElasticsearch.d.ts +8 -0
- package/definitions/tableElasticsearch.js +24 -0
- package/definitions/tableElasticsearch.js.map +1 -0
- package/dynamoDb/index.d.ts +2 -0
- package/dynamoDb/index.js +16 -0
- package/dynamoDb/index.js.map +1 -0
- package/dynamoDb/storage/date.d.ts +3 -0
- package/dynamoDb/storage/date.js +99 -0
- package/dynamoDb/storage/date.js.map +1 -0
- package/dynamoDb/storage/longText.d.ts +10 -0
- package/dynamoDb/storage/longText.js +108 -0
- package/dynamoDb/storage/longText.js.map +1 -0
- package/dynamoDb/storage/richText.d.ts +7 -0
- package/dynamoDb/storage/richText.js +128 -0
- package/dynamoDb/storage/richText.js.map +1 -0
- package/elasticsearch/createElasticsearchIndex.d.ts +9 -0
- package/elasticsearch/createElasticsearchIndex.js +60 -0
- package/elasticsearch/createElasticsearchIndex.js.map +1 -0
- package/elasticsearch/deleteElasticsearchIndex.d.ts +8 -0
- package/elasticsearch/deleteElasticsearchIndex.js +43 -0
- package/elasticsearch/deleteElasticsearchIndex.js.map +1 -0
- package/elasticsearch/index.d.ts +2 -0
- package/elasticsearch/index.js +16 -0
- package/elasticsearch/index.js.map +1 -0
- package/elasticsearch/indexing/dateTimeIndexing.d.ts +3 -0
- package/elasticsearch/indexing/dateTimeIndexing.js +103 -0
- package/elasticsearch/indexing/dateTimeIndexing.js.map +1 -0
- package/elasticsearch/indexing/defaultFieldIndexing.d.ts +3 -0
- package/elasticsearch/indexing/defaultFieldIndexing.js +47 -0
- package/elasticsearch/indexing/defaultFieldIndexing.js.map +1 -0
- package/elasticsearch/indexing/index.d.ts +2 -0
- package/elasticsearch/indexing/index.js +24 -0
- package/elasticsearch/indexing/index.js.map +1 -0
- package/elasticsearch/indexing/longTextIndexing.d.ts +7 -0
- package/elasticsearch/indexing/longTextIndexing.js +52 -0
- package/elasticsearch/indexing/longTextIndexing.js.map +1 -0
- package/elasticsearch/indexing/numberIndexing.d.ts +3 -0
- package/elasticsearch/indexing/numberIndexing.js +48 -0
- package/elasticsearch/indexing/numberIndexing.js.map +1 -0
- package/elasticsearch/indexing/objectIndexing.d.ts +12 -0
- package/elasticsearch/indexing/objectIndexing.js +223 -0
- package/elasticsearch/indexing/objectIndexing.js.map +1 -0
- package/elasticsearch/indexing/richTextIndexing.d.ts +3 -0
- package/elasticsearch/indexing/richTextIndexing.js +34 -0
- package/elasticsearch/indexing/richTextIndexing.js.map +1 -0
- package/elasticsearch/indices/base.d.ts +2 -0
- package/elasticsearch/indices/base.js +15 -0
- package/elasticsearch/indices/base.js.map +1 -0
- package/elasticsearch/indices/index.d.ts +1 -0
- package/elasticsearch/indices/index.js +16 -0
- package/elasticsearch/indices/index.js.map +1 -0
- package/elasticsearch/indices/japanese.d.ts +2 -0
- package/elasticsearch/indices/japanese.js +16 -0
- package/elasticsearch/indices/japanese.js.map +1 -0
- package/elasticsearch/search/index.d.ts +3 -0
- package/elasticsearch/search/index.js +14 -0
- package/elasticsearch/search/index.js.map +1 -0
- package/elasticsearch/search/refSearch.d.ts +2 -0
- package/elasticsearch/search/refSearch.js +35 -0
- package/elasticsearch/search/refSearch.js.map +1 -0
- package/elasticsearch/search/timeSearch.d.ts +2 -0
- package/elasticsearch/search/timeSearch.js +33 -0
- package/elasticsearch/search/timeSearch.js.map +1 -0
- package/helpers/entryIndexHelpers.d.ts +18 -0
- package/helpers/entryIndexHelpers.js +204 -0
- package/helpers/entryIndexHelpers.js.map +1 -0
- package/helpers/index.d.ts +1 -0
- package/helpers/index.js +18 -0
- package/helpers/index.js.map +1 -0
- package/index.d.ts +3 -0
- package/index.js +275 -0
- package/index.js.map +1 -0
- package/operations/entry/dataLoaders.d.ts +51 -0
- package/operations/entry/dataLoaders.js +365 -0
- package/operations/entry/dataLoaders.js.map +1 -0
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +18 -0
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +34 -0
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +1 -0
- package/operations/entry/elasticsearch/body.d.ts +13 -0
- package/operations/entry/elasticsearch/body.js +162 -0
- package/operations/entry/elasticsearch/body.js.map +1 -0
- package/operations/entry/elasticsearch/fields.d.ts +9 -0
- package/operations/entry/elasticsearch/fields.js +248 -0
- package/operations/entry/elasticsearch/fields.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +8 -0
- package/operations/entry/elasticsearch/filtering/applyFiltering.js +66 -0
- package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/exec.d.ts +17 -0
- package/operations/entry/elasticsearch/filtering/exec.js +215 -0
- package/operations/entry/elasticsearch/filtering/exec.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/index.d.ts +1 -0
- package/operations/entry/elasticsearch/filtering/index.js +18 -0
- package/operations/entry/elasticsearch/filtering/index.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/path.d.ts +15 -0
- package/operations/entry/elasticsearch/filtering/path.js +52 -0
- package/operations/entry/elasticsearch/filtering/path.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.d.ts +2 -0
- package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +35 -0
- package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/plugins/index.d.ts +1 -0
- package/operations/entry/elasticsearch/filtering/plugins/index.js +18 -0
- package/operations/entry/elasticsearch/filtering/plugins/index.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.d.ts +2 -0
- package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +78 -0
- package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.d.ts +2 -0
- package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +58 -0
- package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/populated.d.ts +2 -0
- package/operations/entry/elasticsearch/filtering/populated.js +30 -0
- package/operations/entry/elasticsearch/filtering/populated.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/values.d.ts +2 -0
- package/operations/entry/elasticsearch/filtering/values.js +28 -0
- package/operations/entry/elasticsearch/filtering/values.js.map +1 -0
- package/operations/entry/elasticsearch/fullTextSearch.d.ts +9 -0
- package/operations/entry/elasticsearch/fullTextSearch.js +34 -0
- package/operations/entry/elasticsearch/fullTextSearch.js.map +1 -0
- package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +8 -0
- package/operations/entry/elasticsearch/fullTextSearchFields.js +52 -0
- package/operations/entry/elasticsearch/fullTextSearchFields.js.map +1 -0
- package/operations/entry/elasticsearch/initialQuery.d.ts +17 -0
- package/operations/entry/elasticsearch/initialQuery.js +117 -0
- package/operations/entry/elasticsearch/initialQuery.js.map +1 -0
- package/operations/entry/elasticsearch/keyword.d.ts +2 -0
- package/operations/entry/elasticsearch/keyword.js +38 -0
- package/operations/entry/elasticsearch/keyword.js.map +1 -0
- package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +9 -0
- package/operations/entry/elasticsearch/plugins/bodyModifier.js +19 -0
- package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +1 -0
- package/operations/entry/elasticsearch/plugins/operator.d.ts +8 -0
- package/operations/entry/elasticsearch/plugins/operator.js +45 -0
- package/operations/entry/elasticsearch/plugins/operator.js.map +1 -0
- package/operations/entry/elasticsearch/plugins/queryModifier.d.ts +9 -0
- package/operations/entry/elasticsearch/plugins/queryModifier.js +19 -0
- package/operations/entry/elasticsearch/plugins/queryModifier.js.map +1 -0
- package/operations/entry/elasticsearch/plugins/search.d.ts +7 -0
- package/operations/entry/elasticsearch/plugins/search.js +30 -0
- package/operations/entry/elasticsearch/plugins/search.js.map +1 -0
- package/operations/entry/elasticsearch/plugins/sortModifier.d.ts +9 -0
- package/operations/entry/elasticsearch/plugins/sortModifier.js +19 -0
- package/operations/entry/elasticsearch/plugins/sortModifier.js.map +1 -0
- package/operations/entry/elasticsearch/sort.d.ts +12 -0
- package/operations/entry/elasticsearch/sort.js +92 -0
- package/operations/entry/elasticsearch/sort.js.map +1 -0
- package/operations/entry/elasticsearch/transformValueForSearch.d.ts +16 -0
- package/operations/entry/elasticsearch/transformValueForSearch.js +34 -0
- package/operations/entry/elasticsearch/transformValueForSearch.js.map +1 -0
- package/operations/entry/elasticsearch/types.d.ts +41 -0
- package/operations/entry/elasticsearch/types.js +5 -0
- package/operations/entry/elasticsearch/types.js.map +1 -0
- package/operations/entry/elasticsearchFields.d.ts +2 -0
- package/operations/entry/elasticsearchFields.js +38 -0
- package/operations/entry/elasticsearchFields.js.map +1 -0
- package/operations/entry/index.d.ts +11 -0
- package/operations/entry/index.js +1251 -0
- package/operations/entry/index.js.map +1 -0
- package/operations/entry/keys.d.ts +12 -0
- package/operations/entry/keys.js +40 -0
- package/operations/entry/keys.js.map +1 -0
- package/operations/entry/recordType.d.ts +3 -0
- package/operations/entry/recordType.js +24 -0
- package/operations/entry/recordType.js.map +1 -0
- package/operations/group/index.d.ts +8 -0
- package/operations/group/index.js +195 -0
- package/operations/group/index.js.map +1 -0
- package/operations/model/index.d.ts +8 -0
- package/operations/model/index.js +204 -0
- package/operations/model/index.js.map +1 -0
- package/operations/settings/index.d.ts +6 -0
- package/operations/settings/index.js +135 -0
- package/operations/settings/index.js.map +1 -0
- package/operations/system/index.d.ts +6 -0
- package/operations/system/index.js +99 -0
- package/operations/system/index.js.map +1 -0
- package/package.json +68 -0
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +20 -0
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +24 -0
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchFieldPlugin.d.ts +12 -0
- package/plugins/CmsEntryElasticsearchFieldPlugin.js +24 -0
- package/plugins/CmsEntryElasticsearchFieldPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchIndexPlugin.d.ts +4 -0
- package/plugins/CmsEntryElasticsearchIndexPlugin.js +17 -0
- package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +30 -0
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +43 -0
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +17 -0
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +24 -0
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +17 -0
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +24 -0
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +1 -0
- package/plugins/CmsEntryFilterPlugin.d.ts +49 -0
- package/plugins/CmsEntryFilterPlugin.js +31 -0
- package/plugins/CmsEntryFilterPlugin.js.map +1 -0
- package/plugins/index.d.ts +6 -0
- package/plugins/index.js +83 -0
- package/plugins/index.js.map +1 -0
- package/types.d.ts +164 -0
- package/types.js +47 -0
- package/types.js.map +1 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.createModelFields = void 0;
|
|
9
|
+
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
|
+
|
|
12
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
13
|
+
|
|
14
|
+
const createSystemField = field => {
|
|
15
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, field), {}, {
|
|
16
|
+
id: field.fieldId,
|
|
17
|
+
label: field.fieldId
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const createSystemFields = () => {
|
|
22
|
+
return {
|
|
23
|
+
id: {
|
|
24
|
+
type: "text",
|
|
25
|
+
isSystemField: true,
|
|
26
|
+
isSearchable: true,
|
|
27
|
+
isSortable: true,
|
|
28
|
+
field: createSystemField({
|
|
29
|
+
storageId: "id",
|
|
30
|
+
fieldId: "id",
|
|
31
|
+
type: "text"
|
|
32
|
+
}),
|
|
33
|
+
parents: []
|
|
34
|
+
},
|
|
35
|
+
entryId: {
|
|
36
|
+
type: "text",
|
|
37
|
+
isSystemField: true,
|
|
38
|
+
isSearchable: true,
|
|
39
|
+
isSortable: true,
|
|
40
|
+
field: createSystemField({
|
|
41
|
+
storageId: "entryId",
|
|
42
|
+
fieldId: "entryId",
|
|
43
|
+
type: "text"
|
|
44
|
+
}),
|
|
45
|
+
parents: []
|
|
46
|
+
},
|
|
47
|
+
savedOn: {
|
|
48
|
+
type: "date",
|
|
49
|
+
unmappedType: "date",
|
|
50
|
+
keyword: false,
|
|
51
|
+
isSystemField: true,
|
|
52
|
+
isSearchable: true,
|
|
53
|
+
isSortable: true,
|
|
54
|
+
field: createSystemField({
|
|
55
|
+
storageId: "savedOn",
|
|
56
|
+
fieldId: "savedOn",
|
|
57
|
+
type: "datetime",
|
|
58
|
+
settings: {
|
|
59
|
+
type: "dateTimeWithoutTimezone"
|
|
60
|
+
}
|
|
61
|
+
}),
|
|
62
|
+
parents: []
|
|
63
|
+
},
|
|
64
|
+
createdOn: {
|
|
65
|
+
type: "date",
|
|
66
|
+
unmappedType: "date",
|
|
67
|
+
keyword: false,
|
|
68
|
+
isSystemField: true,
|
|
69
|
+
isSearchable: true,
|
|
70
|
+
isSortable: true,
|
|
71
|
+
field: createSystemField({
|
|
72
|
+
storageId: "createdOn",
|
|
73
|
+
fieldId: "createdOn",
|
|
74
|
+
type: "text",
|
|
75
|
+
settings: {
|
|
76
|
+
type: "dateTimeWithoutTimezone"
|
|
77
|
+
}
|
|
78
|
+
}),
|
|
79
|
+
parents: []
|
|
80
|
+
},
|
|
81
|
+
createdBy: {
|
|
82
|
+
type: "text",
|
|
83
|
+
unmappedType: undefined,
|
|
84
|
+
isSystemField: true,
|
|
85
|
+
isSearchable: true,
|
|
86
|
+
isSortable: false,
|
|
87
|
+
path: "createdBy.id",
|
|
88
|
+
field: createSystemField({
|
|
89
|
+
storageId: "createdBy",
|
|
90
|
+
fieldId: "createdBy",
|
|
91
|
+
type: "text"
|
|
92
|
+
}),
|
|
93
|
+
parents: []
|
|
94
|
+
},
|
|
95
|
+
ownedBy: {
|
|
96
|
+
type: "text",
|
|
97
|
+
unmappedType: undefined,
|
|
98
|
+
isSystemField: true,
|
|
99
|
+
isSearchable: true,
|
|
100
|
+
isSortable: false,
|
|
101
|
+
path: "ownedBy.id",
|
|
102
|
+
field: createSystemField({
|
|
103
|
+
storageId: "ownedBy",
|
|
104
|
+
fieldId: "ownedBy",
|
|
105
|
+
type: "text"
|
|
106
|
+
}),
|
|
107
|
+
parents: []
|
|
108
|
+
},
|
|
109
|
+
version: {
|
|
110
|
+
type: "number",
|
|
111
|
+
unmappedType: undefined,
|
|
112
|
+
keyword: false,
|
|
113
|
+
isSystemField: true,
|
|
114
|
+
isSearchable: true,
|
|
115
|
+
isSortable: true,
|
|
116
|
+
field: createSystemField({
|
|
117
|
+
storageId: "version",
|
|
118
|
+
fieldId: "version",
|
|
119
|
+
type: "number"
|
|
120
|
+
}),
|
|
121
|
+
parents: []
|
|
122
|
+
},
|
|
123
|
+
status: {
|
|
124
|
+
type: "string",
|
|
125
|
+
unmappedType: undefined,
|
|
126
|
+
keyword: false,
|
|
127
|
+
isSystemField: true,
|
|
128
|
+
isSearchable: true,
|
|
129
|
+
isSortable: false,
|
|
130
|
+
field: createSystemField({
|
|
131
|
+
storageId: "status",
|
|
132
|
+
fieldId: "status",
|
|
133
|
+
type: "string"
|
|
134
|
+
}),
|
|
135
|
+
parents: []
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const buildFieldsList = params => {
|
|
141
|
+
const {
|
|
142
|
+
plugins,
|
|
143
|
+
fields,
|
|
144
|
+
parents
|
|
145
|
+
} = params;
|
|
146
|
+
return fields.reduce((result, field) => {
|
|
147
|
+
var _field$settings;
|
|
148
|
+
|
|
149
|
+
const plugin = plugins[field.type];
|
|
150
|
+
|
|
151
|
+
if (!plugin) {
|
|
152
|
+
throw new _error.default(`There is no plugin for field type "${field.type}".`);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const {
|
|
156
|
+
isSearchable,
|
|
157
|
+
isSortable,
|
|
158
|
+
unmappedType,
|
|
159
|
+
fullTextSearch
|
|
160
|
+
} = plugin;
|
|
161
|
+
/**
|
|
162
|
+
* If a field has child fields, go through them and add them to a result.
|
|
163
|
+
*/
|
|
164
|
+
|
|
165
|
+
const childFields = ((_field$settings = field.settings) === null || _field$settings === void 0 ? void 0 : _field$settings.fields) || [];
|
|
166
|
+
|
|
167
|
+
if (childFields.length > 0) {
|
|
168
|
+
/**
|
|
169
|
+
* Let's build all the child fields
|
|
170
|
+
*/
|
|
171
|
+
const childResult = buildFieldsList({
|
|
172
|
+
fields: childFields,
|
|
173
|
+
plugins,
|
|
174
|
+
parents: [...parents, {
|
|
175
|
+
fieldId: field.fieldId,
|
|
176
|
+
storageId: field.storageId,
|
|
177
|
+
type: field.type
|
|
178
|
+
}]
|
|
179
|
+
});
|
|
180
|
+
/**
|
|
181
|
+
*
|
|
182
|
+
*/
|
|
183
|
+
|
|
184
|
+
Object.assign(result, childResult);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const identifier = [...parents.map(p => p.fieldId), field.fieldId].join(".");
|
|
188
|
+
result[identifier] = {
|
|
189
|
+
type: field.type,
|
|
190
|
+
parents,
|
|
191
|
+
isSearchable,
|
|
192
|
+
isSortable,
|
|
193
|
+
fullTextSearch,
|
|
194
|
+
unmappedType: typeof unmappedType === "function" ? unmappedType(field) : undefined,
|
|
195
|
+
isSystemField: false,
|
|
196
|
+
field
|
|
197
|
+
};
|
|
198
|
+
return result;
|
|
199
|
+
}, {});
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
const createModelFields = ({
|
|
203
|
+
plugins,
|
|
204
|
+
fields
|
|
205
|
+
}) => {
|
|
206
|
+
if (!fields || fields.length === 0) {
|
|
207
|
+
return createSystemFields();
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Collect all unmappedType from elastic plugins.
|
|
211
|
+
*/
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
const unmappedTypes = plugins.byType("cms-model-field-to-elastic-search").reduce((acc, plugin) => {
|
|
215
|
+
if (!plugin.unmappedType) {
|
|
216
|
+
return acc;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
acc[plugin.fieldType] = plugin.unmappedType;
|
|
220
|
+
return acc;
|
|
221
|
+
}, {});
|
|
222
|
+
/**
|
|
223
|
+
* Collect all field types from the plugins.
|
|
224
|
+
*/
|
|
225
|
+
|
|
226
|
+
const fieldTypePlugins = plugins.byType("cms-model-field-to-graphql").reduce((types, plugin) => {
|
|
227
|
+
const {
|
|
228
|
+
fieldType,
|
|
229
|
+
isSearchable,
|
|
230
|
+
isSortable,
|
|
231
|
+
fullTextSearch
|
|
232
|
+
} = plugin;
|
|
233
|
+
types[fieldType] = {
|
|
234
|
+
unmappedType: unmappedTypes[fieldType],
|
|
235
|
+
isSearchable,
|
|
236
|
+
isSortable,
|
|
237
|
+
fullTextSearch
|
|
238
|
+
};
|
|
239
|
+
return types;
|
|
240
|
+
}, {});
|
|
241
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, createSystemFields()), buildFieldsList({
|
|
242
|
+
fields,
|
|
243
|
+
plugins: fieldTypePlugins,
|
|
244
|
+
parents: []
|
|
245
|
+
}));
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
exports.createModelFields = createModelFields;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createSystemField","field","id","fieldId","label","createSystemFields","type","isSystemField","isSearchable","isSortable","storageId","parents","entryId","savedOn","unmappedType","keyword","settings","createdOn","createdBy","undefined","path","ownedBy","version","status","buildFieldsList","params","plugins","fields","reduce","result","plugin","WebinyError","fullTextSearch","childFields","length","childResult","Object","assign","identifier","map","p","join","createModelFields","unmappedTypes","byType","acc","fieldType","fieldTypePlugins","types"],"sources":["fields.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { CmsModelField, CmsModelFieldToGraphQLPlugin } from \"@webiny/api-headless-cms/types\";\nimport { CmsModelFieldToElasticsearchPlugin } from \"~/types\";\nimport { ModelFieldParent, ModelFields } from \"./types\";\n\ntype PartialCmsModelField = Partial<CmsModelField> &\n Pick<CmsModelField, \"storageId\" | \"fieldId\" | \"type\">;\nconst createSystemField = (field: PartialCmsModelField): CmsModelField => {\n return {\n ...field,\n id: field.fieldId,\n label: field.fieldId\n };\n};\n\nconst createSystemFields = (): ModelFields => {\n return {\n id: {\n type: \"text\",\n isSystemField: true,\n isSearchable: true,\n isSortable: true,\n field: createSystemField({\n storageId: \"id\",\n fieldId: \"id\",\n type: \"text\"\n }),\n parents: []\n },\n entryId: {\n type: \"text\",\n isSystemField: true,\n isSearchable: true,\n isSortable: true,\n field: createSystemField({\n storageId: \"entryId\",\n fieldId: \"entryId\",\n type: \"text\"\n }),\n parents: []\n },\n savedOn: {\n type: \"date\",\n unmappedType: \"date\",\n keyword: false,\n isSystemField: true,\n isSearchable: true,\n isSortable: true,\n field: createSystemField({\n storageId: \"savedOn\",\n fieldId: \"savedOn\",\n type: \"datetime\",\n settings: {\n type: \"dateTimeWithoutTimezone\"\n }\n }),\n parents: []\n },\n createdOn: {\n type: \"date\",\n unmappedType: \"date\",\n keyword: false,\n isSystemField: true,\n isSearchable: true,\n isSortable: true,\n field: createSystemField({\n storageId: \"createdOn\",\n fieldId: \"createdOn\",\n type: \"text\",\n settings: {\n type: \"dateTimeWithoutTimezone\"\n }\n }),\n parents: []\n },\n createdBy: {\n type: \"text\",\n unmappedType: undefined,\n isSystemField: true,\n isSearchable: true,\n isSortable: false,\n path: \"createdBy.id\",\n field: createSystemField({\n storageId: \"createdBy\",\n fieldId: \"createdBy\",\n type: \"text\"\n }),\n parents: []\n },\n ownedBy: {\n type: \"text\",\n unmappedType: undefined,\n isSystemField: true,\n isSearchable: true,\n isSortable: false,\n path: \"ownedBy.id\",\n field: createSystemField({\n storageId: \"ownedBy\",\n fieldId: \"ownedBy\",\n type: \"text\"\n }),\n parents: []\n },\n version: {\n type: \"number\",\n unmappedType: undefined,\n keyword: false,\n isSystemField: true,\n isSearchable: true,\n isSortable: true,\n field: createSystemField({\n storageId: \"version\",\n fieldId: \"version\",\n type: \"number\"\n }),\n parents: []\n },\n status: {\n type: \"string\",\n unmappedType: undefined,\n keyword: false,\n isSystemField: true,\n isSearchable: true,\n isSortable: false,\n field: createSystemField({\n storageId: \"status\",\n fieldId: \"status\",\n type: \"string\"\n }),\n parents: []\n }\n };\n};\n\ninterface UnmappedFieldTypes {\n [type: string]: (field: CmsModelField) => string | undefined;\n}\n\ninterface FieldTypePlugin {\n unmappedType?: (field: CmsModelField) => string | undefined;\n isSearchable: boolean;\n isSortable: boolean;\n fullTextSearch?: boolean;\n}\ninterface FieldTypePlugins {\n [key: string]: FieldTypePlugin;\n}\n\ninterface BuildParams {\n plugins: FieldTypePlugins;\n fields: CmsModelField[];\n parents: ModelFieldParent[];\n}\nconst buildFieldsList = (params: BuildParams): ModelFields => {\n const { plugins, fields, parents } = params;\n\n return fields.reduce<ModelFields>((result, field) => {\n const plugin = plugins[field.type];\n if (!plugin) {\n throw new WebinyError(`There is no plugin for field type \"${field.type}\".`);\n }\n\n const { isSearchable, isSortable, unmappedType, fullTextSearch } = plugin;\n /**\n * If a field has child fields, go through them and add them to a result.\n */\n const childFields = field.settings?.fields || [];\n if (childFields.length > 0) {\n /**\n * Let's build all the child fields\n */\n const childResult = buildFieldsList({\n fields: childFields,\n plugins,\n parents: [\n ...parents,\n {\n fieldId: field.fieldId,\n storageId: field.storageId,\n type: field.type\n }\n ]\n });\n /**\n *\n */\n Object.assign(result, childResult);\n }\n\n const identifier = [...parents.map(p => p.fieldId), field.fieldId].join(\".\");\n\n result[identifier] = {\n type: field.type,\n parents,\n isSearchable,\n isSortable,\n fullTextSearch,\n unmappedType: typeof unmappedType === \"function\" ? unmappedType(field) : undefined,\n isSystemField: false,\n field\n };\n\n return result;\n }, {});\n};\n\ninterface Params {\n plugins: PluginsContainer;\n fields?: CmsModelField[];\n}\nexport const createModelFields = ({ plugins, fields }: Params) => {\n if (!fields || fields.length === 0) {\n return createSystemFields();\n }\n /**\n * Collect all unmappedType from elastic plugins.\n */\n const unmappedTypes = plugins\n .byType<CmsModelFieldToElasticsearchPlugin>(\"cms-model-field-to-elastic-search\")\n .reduce<UnmappedFieldTypes>((acc, plugin) => {\n if (!plugin.unmappedType) {\n return acc;\n }\n acc[plugin.fieldType] = plugin.unmappedType;\n return acc;\n }, {});\n /**\n * Collect all field types from the plugins.\n */\n const fieldTypePlugins = plugins\n .byType<CmsModelFieldToGraphQLPlugin>(\"cms-model-field-to-graphql\")\n .reduce<FieldTypePlugins>((types, plugin) => {\n const { fieldType, isSearchable, isSortable, fullTextSearch } = plugin;\n types[fieldType] = {\n unmappedType: unmappedTypes[fieldType],\n isSearchable,\n isSortable,\n fullTextSearch\n };\n return types;\n }, {});\n\n return {\n ...createSystemFields(),\n ...buildFieldsList({\n fields,\n plugins: fieldTypePlugins,\n parents: []\n })\n };\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AAQA,MAAMA,iBAAiB,GAAIC,KAAD,IAAgD;EACtE,mEACOA,KADP;IAEIC,EAAE,EAAED,KAAK,CAACE,OAFd;IAGIC,KAAK,EAAEH,KAAK,CAACE;EAHjB;AAKH,CAND;;AAQA,MAAME,kBAAkB,GAAG,MAAmB;EAC1C,OAAO;IACHH,EAAE,EAAE;MACAI,IAAI,EAAE,MADN;MAEAC,aAAa,EAAE,IAFf;MAGAC,YAAY,EAAE,IAHd;MAIAC,UAAU,EAAE,IAJZ;MAKAR,KAAK,EAAED,iBAAiB,CAAC;QACrBU,SAAS,EAAE,IADU;QAErBP,OAAO,EAAE,IAFY;QAGrBG,IAAI,EAAE;MAHe,CAAD,CALxB;MAUAK,OAAO,EAAE;IAVT,CADD;IAaHC,OAAO,EAAE;MACLN,IAAI,EAAE,MADD;MAELC,aAAa,EAAE,IAFV;MAGLC,YAAY,EAAE,IAHT;MAILC,UAAU,EAAE,IAJP;MAKLR,KAAK,EAAED,iBAAiB,CAAC;QACrBU,SAAS,EAAE,SADU;QAErBP,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CAAC;EAAEhB,OAAF;EAAWC;AAAX,CAAD,KAAiC;EAC9D,IAAI,CAACA,MAAD,IAAWA,MAAM,CAACO,MAAP,KAAkB,CAAjC,EAAoC;IAChC,OAAO7B,kBAAkB,EAAzB;EACH;EACD;AACJ;AACA;;;EACI,MAAMsC,aAAa,GAAGjB,OAAO,CACxBkB,MADiB,CAC0B,mCAD1B,EAEjBhB,MAFiB,CAEU,CAACiB,GAAD,EAAMf,MAAN,KAAiB;IACzC,IAAI,CAACA,MAAM,CAAChB,YAAZ,EAA0B;MACtB,OAAO+B,GAAP;IACH;;IACDA,GAAG,CAACf,MAAM,CAACgB,SAAR,CAAH,GAAwBhB,MAAM,CAAChB,YAA/B;IACA,OAAO+B,GAAP;EACH,CARiB,EAQf,EARe,CAAtB;EASA;AACJ;AACA;;EACI,MAAME,gBAAgB,GAAGrB,OAAO,CAC3BkB,MADoB,CACiB,4BADjB,EAEpBhB,MAFoB,CAEK,CAACoB,KAAD,EAAQlB,MAAR,KAAmB;IACzC,MAAM;MAAEgB,SAAF;MAAatC,YAAb;MAA2BC,UAA3B;MAAuCuB;IAAvC,IAA0DF,MAAhE;IACAkB,KAAK,CAACF,SAAD,CAAL,GAAmB;MACfhC,YAAY,EAAE6B,aAAa,CAACG,SAAD,CADZ;MAEftC,YAFe;MAGfC,UAHe;MAIfuB;IAJe,CAAnB;IAMA,OAAOgB,KAAP;EACH,CAXoB,EAWlB,EAXkB,CAAzB;EAaA,mEACO3C,kBAAkB,EADzB,GAEOmB,eAAe,CAAC;IACfG,MADe;IAEfD,OAAO,EAAEqB,gBAFM;IAGfpC,OAAO,EAAE;EAHM,CAAD,CAFtB;AAQH,CAxCM"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ElasticsearchQueryBuilderOperatorPlugins, ElasticsearchQuerySearchValuePlugins } from "../types";
|
|
2
|
+
import { ApplyFilteringCb } from "../../../../plugins/CmsEntryFilterPlugin";
|
|
3
|
+
interface CreateParams {
|
|
4
|
+
operatorPlugins: ElasticsearchQueryBuilderOperatorPlugins;
|
|
5
|
+
searchPlugins: ElasticsearchQuerySearchValuePlugins;
|
|
6
|
+
}
|
|
7
|
+
export declare const createApplyFiltering: ({ operatorPlugins, searchPlugins }: CreateParams) => ApplyFilteringCb;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.createApplyFiltering = void 0;
|
|
9
|
+
|
|
10
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
11
|
+
|
|
12
|
+
var _transformValueForSearch = require("../transformValueForSearch");
|
|
13
|
+
|
|
14
|
+
var _keyword = require("../keyword");
|
|
15
|
+
|
|
16
|
+
var _path = require("./path");
|
|
17
|
+
|
|
18
|
+
const createApplyFiltering = ({
|
|
19
|
+
operatorPlugins,
|
|
20
|
+
searchPlugins
|
|
21
|
+
}) => {
|
|
22
|
+
const createFieldPath = (0, _path.createFieldPathFactory)({
|
|
23
|
+
plugins: searchPlugins
|
|
24
|
+
});
|
|
25
|
+
return params => {
|
|
26
|
+
const {
|
|
27
|
+
key,
|
|
28
|
+
value: initialValue,
|
|
29
|
+
query,
|
|
30
|
+
operator,
|
|
31
|
+
field
|
|
32
|
+
} = params;
|
|
33
|
+
const plugin = operatorPlugins[operator];
|
|
34
|
+
|
|
35
|
+
if (!plugin) {
|
|
36
|
+
throw new _error.default("Operator plugin missing.", "PLUGIN_MISSING", {
|
|
37
|
+
operator
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const value = (0, _transformValueForSearch.transformValueForSearch)({
|
|
42
|
+
plugins: searchPlugins,
|
|
43
|
+
field: field.field,
|
|
44
|
+
value: initialValue
|
|
45
|
+
});
|
|
46
|
+
const keyword = (0, _keyword.hasKeyword)(field);
|
|
47
|
+
const {
|
|
48
|
+
basePath,
|
|
49
|
+
path
|
|
50
|
+
} = createFieldPath({
|
|
51
|
+
field,
|
|
52
|
+
value,
|
|
53
|
+
key,
|
|
54
|
+
keyword
|
|
55
|
+
});
|
|
56
|
+
plugin.apply(query, {
|
|
57
|
+
name: field.field.fieldId,
|
|
58
|
+
basePath,
|
|
59
|
+
path,
|
|
60
|
+
value,
|
|
61
|
+
keyword
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
exports.createApplyFiltering = createApplyFiltering;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createApplyFiltering","operatorPlugins","searchPlugins","createFieldPath","createFieldPathFactory","plugins","params","key","value","initialValue","query","operator","field","plugin","WebinyError","transformValueForSearch","keyword","hasKeyword","basePath","path","apply","name","fieldId"],"sources":["applyFiltering.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { transformValueForSearch } from \"~/operations/entry/elasticsearch/transformValueForSearch\";\nimport { hasKeyword } from \"~/operations/entry/elasticsearch/keyword\";\nimport {\n ElasticsearchQueryBuilderOperatorPlugins,\n ElasticsearchQuerySearchValuePlugins\n} from \"~/operations/entry/elasticsearch/types\";\nimport { createFieldPathFactory } from \"~/operations/entry/elasticsearch/filtering/path\";\nimport { ApplyFilteringCb } from \"~/plugins/CmsEntryFilterPlugin\";\n\ninterface CreateParams {\n operatorPlugins: ElasticsearchQueryBuilderOperatorPlugins;\n searchPlugins: ElasticsearchQuerySearchValuePlugins;\n}\n\nexport const createApplyFiltering = ({\n operatorPlugins,\n searchPlugins\n}: CreateParams): ApplyFilteringCb => {\n const createFieldPath = createFieldPathFactory({\n plugins: searchPlugins\n });\n\n return params => {\n const { key, value: initialValue, query, operator, field } = params;\n\n const plugin = operatorPlugins[operator];\n if (!plugin) {\n throw new WebinyError(\"Operator plugin missing.\", \"PLUGIN_MISSING\", {\n operator\n });\n }\n\n const value = transformValueForSearch({\n plugins: searchPlugins,\n field: field.field,\n value: initialValue\n });\n\n const keyword = hasKeyword(field);\n\n const { basePath, path } = createFieldPath({\n field,\n value,\n key,\n keyword\n });\n\n plugin.apply(query, {\n name: field.field.fieldId,\n basePath,\n path,\n value,\n keyword\n });\n };\n};\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAKA;;AAQO,MAAMA,oBAAoB,GAAG,CAAC;EACjCC,eADiC;EAEjCC;AAFiC,CAAD,KAGE;EAClC,MAAMC,eAAe,GAAG,IAAAC,4BAAA,EAAuB;IAC3CC,OAAO,EAAEH;EADkC,CAAvB,CAAxB;EAIA,OAAOI,MAAM,IAAI;IACb,MAAM;MAAEC,GAAF;MAAOC,KAAK,EAAEC,YAAd;MAA4BC,KAA5B;MAAmCC,QAAnC;MAA6CC;IAA7C,IAAuDN,MAA7D;IAEA,MAAMO,MAAM,GAAGZ,eAAe,CAACU,QAAD,CAA9B;;IACA,IAAI,CAACE,MAAL,EAAa;MACT,MAAM,IAAIC,cAAJ,CAAgB,0BAAhB,EAA4C,gBAA5C,EAA8D;QAChEH;MADgE,CAA9D,CAAN;IAGH;;IAED,MAAMH,KAAK,GAAG,IAAAO,gDAAA,EAAwB;MAClCV,OAAO,EAAEH,aADyB;MAElCU,KAAK,EAAEA,KAAK,CAACA,KAFqB;MAGlCJ,KAAK,EAAEC;IAH2B,CAAxB,CAAd;IAMA,MAAMO,OAAO,GAAG,IAAAC,mBAAA,EAAWL,KAAX,CAAhB;IAEA,MAAM;MAAEM,QAAF;MAAYC;IAAZ,IAAqBhB,eAAe,CAAC;MACvCS,KADuC;MAEvCJ,KAFuC;MAGvCD,GAHuC;MAIvCS;IAJuC,CAAD,CAA1C;IAOAH,MAAM,CAACO,KAAP,CAAaV,KAAb,EAAoB;MAChBW,IAAI,EAAET,KAAK,CAACA,KAAN,CAAYU,OADF;MAEhBJ,QAFgB;MAGhBC,IAHgB;MAIhBX,KAJgB;MAKhBQ;IALgB,CAApB;EAOH,CAhCD;AAiCH,CAzCM"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CmsEntryListWhere, CmsModel } from "@webiny/api-headless-cms/types";
|
|
2
|
+
import { ModelFields } from "../types";
|
|
3
|
+
import { PluginsContainer } from "@webiny/plugins";
|
|
4
|
+
import { ElasticsearchBoolQueryConfig } from "@webiny/api-elasticsearch/types";
|
|
5
|
+
export interface CreateExecParams {
|
|
6
|
+
model: CmsModel;
|
|
7
|
+
fields: ModelFields;
|
|
8
|
+
plugins: PluginsContainer;
|
|
9
|
+
}
|
|
10
|
+
export interface ExecParams {
|
|
11
|
+
where: CmsEntryListWhere;
|
|
12
|
+
query: ElasticsearchBoolQueryConfig;
|
|
13
|
+
}
|
|
14
|
+
export interface CreateExecFilteringResponse {
|
|
15
|
+
(params: ExecParams): void;
|
|
16
|
+
}
|
|
17
|
+
export declare const createExecFiltering: (params: CreateExecParams) => CreateExecFilteringResponse;
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.createExecFiltering = void 0;
|
|
9
|
+
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
|
+
|
|
12
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
13
|
+
|
|
14
|
+
var _search = require("../plugins/search");
|
|
15
|
+
|
|
16
|
+
var _operator = require("../plugins/operator");
|
|
17
|
+
|
|
18
|
+
var _initialQuery = require("../initialQuery");
|
|
19
|
+
|
|
20
|
+
var _apiElasticsearch = require("@webiny/api-elasticsearch");
|
|
21
|
+
|
|
22
|
+
var _values = require("./values");
|
|
23
|
+
|
|
24
|
+
var _populated = require("./populated");
|
|
25
|
+
|
|
26
|
+
var _applyFiltering = require("./applyFiltering");
|
|
27
|
+
|
|
28
|
+
var _CmsEntryFilterPlugin = require("../../../../plugins/CmsEntryFilterPlugin");
|
|
29
|
+
|
|
30
|
+
var _assignMinimumShouldMatchToQuery = require("../assignMinimumShouldMatchToQuery");
|
|
31
|
+
|
|
32
|
+
const createExecFiltering = params => {
|
|
33
|
+
const {
|
|
34
|
+
fields,
|
|
35
|
+
plugins,
|
|
36
|
+
model
|
|
37
|
+
} = params;
|
|
38
|
+
/**
|
|
39
|
+
* We need the search plugins as key -> plugin value, so it is easy to find plugin we need, without iterating through array.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
const searchPlugins = (0, _search.createSearchPluginList)({
|
|
43
|
+
plugins
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* We need the operator plugins, which we execute on our where conditions.
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
const operatorPlugins = (0, _operator.createOperatorPluginList)({
|
|
50
|
+
plugins,
|
|
51
|
+
locale: model.locale
|
|
52
|
+
});
|
|
53
|
+
const applyFiltering = (0, _applyFiltering.createApplyFiltering)({
|
|
54
|
+
operatorPlugins,
|
|
55
|
+
searchPlugins
|
|
56
|
+
});
|
|
57
|
+
const filteringPlugins = plugins.byType(_CmsEntryFilterPlugin.CmsEntryFilterPlugin.type).reduce((collection, plugin) => {
|
|
58
|
+
collection[plugin.fieldType] = plugin;
|
|
59
|
+
return collection;
|
|
60
|
+
}, {});
|
|
61
|
+
|
|
62
|
+
const getFilterPlugin = type => {
|
|
63
|
+
const plugin = filteringPlugins[type] || filteringPlugins["*"];
|
|
64
|
+
|
|
65
|
+
if (plugin) {
|
|
66
|
+
return plugin;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
throw new _error.default(`There is no filtering plugin for the given field type "${type}".`, "FILTERING_PLUGIN_ERROR", {
|
|
70
|
+
type
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const execFiltering = params => {
|
|
75
|
+
const {
|
|
76
|
+
where: initialWhere,
|
|
77
|
+
query
|
|
78
|
+
} = params;
|
|
79
|
+
/**
|
|
80
|
+
* No point in continuing if no "where" conditions exist.
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
const keys = Object.keys(initialWhere);
|
|
84
|
+
|
|
85
|
+
if (keys.length === 0) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const where = (0, _objectSpread2.default)({}, initialWhere);
|
|
90
|
+
|
|
91
|
+
for (const key in where) {
|
|
92
|
+
const value = where[key];
|
|
93
|
+
/**
|
|
94
|
+
* We always skip if no value is defined.
|
|
95
|
+
* Only skip undefined value, null is valid.
|
|
96
|
+
*/
|
|
97
|
+
|
|
98
|
+
if (value === undefined) {
|
|
99
|
+
continue;
|
|
100
|
+
} //
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* When we are running with AND, the "value" MUST be an array.
|
|
104
|
+
*/
|
|
105
|
+
else if (key === "AND") {
|
|
106
|
+
const childWhereList = (0, _values.getWhereValues)(value, "AND");
|
|
107
|
+
const childQuery = (0, _initialQuery.createBaseQuery)();
|
|
108
|
+
|
|
109
|
+
for (const childWhere of childWhereList) {
|
|
110
|
+
execFiltering({
|
|
111
|
+
query: childQuery,
|
|
112
|
+
where: childWhere
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const childQueryBool = (0, _populated.getPopulated)(childQuery);
|
|
117
|
+
|
|
118
|
+
if (Object.keys(childQueryBool).length === 0) {
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
query.filter.push({
|
|
123
|
+
bool: childQueryBool
|
|
124
|
+
});
|
|
125
|
+
continue;
|
|
126
|
+
} //
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* When we are running with OR, the "value" must be an array.
|
|
130
|
+
*/
|
|
131
|
+
else if (key === "OR") {
|
|
132
|
+
const childWhereList = (0, _values.getWhereValues)(value, "OR");
|
|
133
|
+
/**
|
|
134
|
+
* Each of the conditions MUST produce it's own should section.
|
|
135
|
+
*/
|
|
136
|
+
|
|
137
|
+
const should = [];
|
|
138
|
+
|
|
139
|
+
for (const childWhere of childWhereList) {
|
|
140
|
+
const childQuery = (0, _initialQuery.createBaseQuery)();
|
|
141
|
+
execFiltering({
|
|
142
|
+
query: childQuery,
|
|
143
|
+
where: childWhere
|
|
144
|
+
});
|
|
145
|
+
const childQueryBool = (0, _populated.getPopulated)(childQuery);
|
|
146
|
+
|
|
147
|
+
if (Object.keys(childQueryBool).length === 0) {
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
should.push({
|
|
152
|
+
bool: childQueryBool
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (should.length === 0) {
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
query.should.push(...should);
|
|
161
|
+
/**
|
|
162
|
+
* If there are any should, minimum to have is 1.
|
|
163
|
+
* Of course, do not override if it's already set.
|
|
164
|
+
*/
|
|
165
|
+
|
|
166
|
+
(0, _assignMinimumShouldMatchToQuery.assignMinimumShouldMatchToQuery)({
|
|
167
|
+
query
|
|
168
|
+
});
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const {
|
|
173
|
+
field: whereFieldId,
|
|
174
|
+
operator
|
|
175
|
+
} = (0, _apiElasticsearch.parseWhereKey)(key);
|
|
176
|
+
let fieldId = whereFieldId;
|
|
177
|
+
/**
|
|
178
|
+
* TODO This will be required until the storage operations receive the fieldId instead of field storageId.
|
|
179
|
+
* TODO For this to work without field searching, we need to refactor how the query looks like.
|
|
180
|
+
*
|
|
181
|
+
* Storage operations should NEVER receive an field storageId, only alias - fieldId.
|
|
182
|
+
*/
|
|
183
|
+
|
|
184
|
+
const cmsModelField = model.fields.find(f => f.fieldId === fieldId);
|
|
185
|
+
|
|
186
|
+
if (!cmsModelField && !fields[fieldId]) {
|
|
187
|
+
throw new _error.default(`There is no CMS Model Field field "${fieldId}".`);
|
|
188
|
+
} else if (cmsModelField) {
|
|
189
|
+
fieldId = cmsModelField.fieldId;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const field = fields[fieldId];
|
|
193
|
+
|
|
194
|
+
if (!field) {
|
|
195
|
+
throw new _error.default(`There is no field "${fieldId}".`);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const filterPlugin = getFilterPlugin(field.type);
|
|
199
|
+
filterPlugin.exec({
|
|
200
|
+
applyFiltering,
|
|
201
|
+
getFilterPlugin,
|
|
202
|
+
key,
|
|
203
|
+
value,
|
|
204
|
+
operator,
|
|
205
|
+
field,
|
|
206
|
+
fields,
|
|
207
|
+
query
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
return execFiltering;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
exports.createExecFiltering = createExecFiltering;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createExecFiltering","params","fields","plugins","model","searchPlugins","createSearchPluginList","operatorPlugins","createOperatorPluginList","locale","applyFiltering","createApplyFiltering","filteringPlugins","byType","CmsEntryFilterPlugin","type","reduce","collection","plugin","fieldType","getFilterPlugin","WebinyError","execFiltering","where","initialWhere","query","keys","Object","length","key","value","undefined","childWhereList","getWhereValues","childQuery","createBaseQuery","childWhere","childQueryBool","getPopulated","filter","push","bool","should","assignMinimumShouldMatchToQuery","field","whereFieldId","operator","parseWhereKey","fieldId","cmsModelField","find","f","filterPlugin","exec"],"sources":["exec.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsEntryListWhere, CmsModel } from \"@webiny/api-headless-cms/types\";\nimport { ModelFields } from \"~/operations/entry/elasticsearch/types\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { ElasticsearchBoolQueryConfig, Query } from \"@webiny/api-elasticsearch/types\";\nimport { createSearchPluginList } from \"~/operations/entry/elasticsearch/plugins/search\";\nimport { createOperatorPluginList } from \"~/operations/entry/elasticsearch/plugins/operator\";\nimport { createBaseQuery } from \"~/operations/entry/elasticsearch/initialQuery\";\nimport { parseWhereKey } from \"@webiny/api-elasticsearch\";\nimport { getWhereValues } from \"./values\";\nimport { getPopulated } from \"./populated\";\nimport { createApplyFiltering } from \"./applyFiltering\";\nimport { CmsEntryFilterPlugin } from \"~/plugins/CmsEntryFilterPlugin\";\nimport { assignMinimumShouldMatchToQuery } from \"~/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery\";\n\nexport interface CreateExecParams {\n model: CmsModel;\n fields: ModelFields;\n plugins: PluginsContainer;\n}\nexport interface ExecParams {\n where: CmsEntryListWhere;\n query: ElasticsearchBoolQueryConfig;\n}\nexport interface CreateExecFilteringResponse {\n (params: ExecParams): void;\n}\nexport const createExecFiltering = (params: CreateExecParams): CreateExecFilteringResponse => {\n const { fields, plugins, model } = params;\n\n /**\n * We need the search plugins as key -> plugin value, so it is easy to find plugin we need, without iterating through array.\n */\n const searchPlugins = createSearchPluginList({\n plugins\n });\n /**\n * We need the operator plugins, which we execute on our where conditions.\n */\n const operatorPlugins = createOperatorPluginList({\n plugins,\n locale: model.locale\n });\n\n const applyFiltering = createApplyFiltering({\n operatorPlugins,\n searchPlugins\n });\n\n const filteringPlugins = plugins\n .byType<CmsEntryFilterPlugin>(CmsEntryFilterPlugin.type)\n .reduce<Record<string, CmsEntryFilterPlugin>>((collection, plugin) => {\n collection[plugin.fieldType] = plugin;\n\n return collection;\n }, {});\n\n const getFilterPlugin = (type: string) => {\n const plugin = filteringPlugins[type] || filteringPlugins[\"*\"];\n if (plugin) {\n return plugin;\n }\n throw new WebinyError(\n `There is no filtering plugin for the given field type \"${type}\".`,\n \"FILTERING_PLUGIN_ERROR\",\n {\n type\n }\n );\n };\n\n const execFiltering = (params: ExecParams) => {\n const { where: initialWhere, query } = params;\n /**\n * No point in continuing if no \"where\" conditions exist.\n */\n const keys = Object.keys(initialWhere);\n if (keys.length === 0) {\n return;\n }\n const where: CmsEntryListWhere = {\n ...initialWhere\n };\n\n for (const key in where) {\n const value = where[key] as unknown as any;\n /**\n * We always skip if no value is defined.\n * Only skip undefined value, null is valid.\n */\n if (value === undefined) {\n continue;\n }\n //\n /**\n * When we are running with AND, the \"value\" MUST be an array.\n */\n else if (key === \"AND\") {\n const childWhereList = getWhereValues(value, \"AND\");\n\n const childQuery = createBaseQuery();\n\n for (const childWhere of childWhereList) {\n execFiltering({\n query: childQuery,\n where: childWhere\n });\n }\n const childQueryBool = getPopulated(childQuery);\n if (Object.keys(childQueryBool).length === 0) {\n continue;\n }\n query.filter.push({\n bool: childQueryBool\n });\n\n continue;\n }\n //\n /**\n * When we are running with OR, the \"value\" must be an array.\n */\n else if (key === \"OR\") {\n const childWhereList = getWhereValues(value, \"OR\");\n /**\n * Each of the conditions MUST produce it's own should section.\n */\n const should: Query[] = [];\n for (const childWhere of childWhereList) {\n const childQuery = createBaseQuery();\n execFiltering({\n query: childQuery,\n where: childWhere\n });\n const childQueryBool = getPopulated(childQuery);\n if (Object.keys(childQueryBool).length === 0) {\n continue;\n }\n should.push({\n bool: childQueryBool\n });\n }\n if (should.length === 0) {\n continue;\n }\n query.should.push(...should);\n /**\n * If there are any should, minimum to have is 1.\n * Of course, do not override if it's already set.\n */\n assignMinimumShouldMatchToQuery({\n query\n });\n continue;\n }\n const { field: whereFieldId, operator } = parseWhereKey(key);\n\n let fieldId: string = whereFieldId;\n\n /**\n * TODO This will be required until the storage operations receive the fieldId instead of field storageId.\n * TODO For this to work without field searching, we need to refactor how the query looks like.\n *\n * Storage operations should NEVER receive an field storageId, only alias - fieldId.\n */\n const cmsModelField = model.fields.find(f => f.fieldId === fieldId);\n if (!cmsModelField && !fields[fieldId]) {\n throw new WebinyError(`There is no CMS Model Field field \"${fieldId}\".`);\n } else if (cmsModelField) {\n fieldId = cmsModelField.fieldId;\n }\n\n const field = fields[fieldId];\n if (!field) {\n throw new WebinyError(`There is no field \"${fieldId}\".`);\n }\n const filterPlugin = getFilterPlugin(field.type);\n\n filterPlugin.exec({\n applyFiltering,\n getFilterPlugin,\n key,\n value,\n operator,\n field,\n fields,\n query\n });\n }\n };\n\n return execFiltering;\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAcO,MAAMA,mBAAmB,GAAIC,MAAD,IAA2D;EAC1F,MAAM;IAAEC,MAAF;IAAUC,OAAV;IAAmBC;EAAnB,IAA6BH,MAAnC;EAEA;AACJ;AACA;;EACI,MAAMI,aAAa,GAAG,IAAAC,8BAAA,EAAuB;IACzCH;EADyC,CAAvB,CAAtB;EAGA;AACJ;AACA;;EACI,MAAMI,eAAe,GAAG,IAAAC,kCAAA,EAAyB;IAC7CL,OAD6C;IAE7CM,MAAM,EAAEL,KAAK,CAACK;EAF+B,CAAzB,CAAxB;EAKA,MAAMC,cAAc,GAAG,IAAAC,oCAAA,EAAqB;IACxCJ,eADwC;IAExCF;EAFwC,CAArB,CAAvB;EAKA,MAAMO,gBAAgB,GAAGT,OAAO,CAC3BU,MADoB,CACSC,0CAAA,CAAqBC,IAD9B,EAEpBC,MAFoB,CAEyB,CAACC,UAAD,EAAaC,MAAb,KAAwB;IAClED,UAAU,CAACC,MAAM,CAACC,SAAR,CAAV,GAA+BD,MAA/B;IAEA,OAAOD,UAAP;EACH,CANoB,EAMlB,EANkB,CAAzB;;EAQA,MAAMG,eAAe,GAAIL,IAAD,IAAkB;IACtC,MAAMG,MAAM,GAAGN,gBAAgB,CAACG,IAAD,CAAhB,IAA0BH,gBAAgB,CAAC,GAAD,CAAzD;;IACA,IAAIM,MAAJ,EAAY;MACR,OAAOA,MAAP;IACH;;IACD,MAAM,IAAIG,cAAJ,CACD,0DAAyDN,IAAK,IAD7D,EAEF,wBAFE,EAGF;MACIA;IADJ,CAHE,CAAN;EAOH,CAZ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AAM,IAAIvB,cAAJ,CAAiB,sBAAqB2B,OAAQ,IAA9C,CAAN;MACH;;MACD,MAAMI,YAAY,GAAGhC,eAAe,CAACwB,KAAK,CAAC7B,IAAP,CAApC;MAEAqC,YAAY,CAACC,IAAb,CAAkB;QACd3C,cADc;QAEdU,eAFc;QAGdS,GAHc;QAIdC,KAJc;QAKdgB,QALc;QAMdF,KANc;QAOd1C,MAPc;QAQduB;MARc,CAAlB;IAUH;EACJ,CAtHD;;EAwHA,OAAOH,aAAP;AACH,CArKM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./exec";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _exec = require("./exec");
|
|
8
|
+
|
|
9
|
+
Object.keys(_exec).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (key in exports && exports[key] === _exec[key]) return;
|
|
12
|
+
Object.defineProperty(exports, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _exec[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./exec\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ElasticsearchQuerySearchValuePlugins, ModelField } from "../types";
|
|
2
|
+
interface FieldPathFactoryParams {
|
|
3
|
+
plugins: ElasticsearchQuerySearchValuePlugins;
|
|
4
|
+
}
|
|
5
|
+
interface FieldPathParams {
|
|
6
|
+
field: ModelField;
|
|
7
|
+
key: string;
|
|
8
|
+
value: any;
|
|
9
|
+
keyword: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const createFieldPathFactory: ({ plugins }: FieldPathFactoryParams) => (params: FieldPathParams) => {
|
|
12
|
+
basePath: string;
|
|
13
|
+
path: string;
|
|
14
|
+
};
|
|
15
|
+
export {};
|