@webiny/api-headless-cms-ddb-es 5.33.5 → 5.34.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 +1 -1
- package/definitions/entry.js +3 -7
- package/definitions/entry.js.map +1 -1
- package/definitions/entryElasticsearch.js +3 -7
- package/definitions/entryElasticsearch.js.map +1 -1
- package/definitions/group.js +3 -7
- package/definitions/group.js.map +1 -1
- package/definitions/model.js +8 -7
- package/definitions/model.js.map +1 -1
- package/definitions/settings.js +3 -7
- package/definitions/settings.js.map +1 -1
- package/definitions/system.js +3 -7
- package/definitions/system.js.map +1 -1
- package/dynamoDb/index.d.ts +1 -1
- package/dynamoDb/storage/date.d.ts +2 -1
- package/dynamoDb/storage/date.js +1 -1
- package/dynamoDb/storage/date.js.map +1 -1
- package/dynamoDb/storage/longText.d.ts +1 -1
- package/dynamoDb/storage/longText.js +8 -1
- package/dynamoDb/storage/longText.js.map +1 -1
- package/dynamoDb/storage/richText.d.ts +1 -1
- package/dynamoDb/storage/richText.js +1 -1
- package/elasticsearch/createElasticsearchIndex.js +1 -1
- package/elasticsearch/index.js +1 -1
- package/elasticsearch/indexing/index.js +1 -1
- package/elasticsearch/indexing/longTextIndexing.d.ts +4 -0
- package/elasticsearch/indexing/longTextIndexing.js +20 -4
- package/elasticsearch/indexing/longTextIndexing.js.map +1 -1
- package/elasticsearch/search/refSearch.js +4 -2
- package/elasticsearch/search/refSearch.js.map +1 -1
- package/helpers/entryIndexHelpers.js +6 -11
- package/helpers/entryIndexHelpers.js.map +1 -1
- package/helpers/index.d.ts +0 -1
- package/helpers/index.js +0 -13
- package/helpers/index.js.map +1 -1
- package/index.js +17 -10
- package/index.js.map +1 -1
- package/operations/entry/dataLoaders.js +7 -9
- package/operations/entry/dataLoaders.js.map +1 -1
- 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/{helpers/searchPluginsList.js → operations/entry/elasticsearch/plugins/search.js} +9 -5
- 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/{helpers → operations/entry/elasticsearch}/transformValueForSearch.js +8 -3
- 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.js +3 -0
- package/operations/entry/elasticsearchFields.js.map +1 -1
- package/operations/entry/index.d.ts +0 -2
- package/operations/entry/index.js +100 -310
- package/operations/entry/index.js.map +1 -1
- 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.js +7 -12
- package/operations/group/index.js.map +1 -1
- package/operations/model/index.js +4 -8
- package/operations/model/index.js.map +1 -1
- package/operations/settings/index.js +6 -10
- package/operations/settings/index.js.map +1 -1
- package/operations/system/index.js +4 -8
- package/operations/system/index.js.map +1 -1
- package/package.json +18 -19
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +1 -1
- package/plugins/CmsEntryElasticsearchFieldPlugin.js +1 -1
- package/plugins/CmsEntryElasticsearchIndexPlugin.js +1 -1
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +1 -1
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +1 -1
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +1 -1
- package/plugins/CmsEntryFilterPlugin.d.ts +49 -0
- package/plugins/CmsEntryFilterPlugin.js +31 -0
- package/plugins/CmsEntryFilterPlugin.js.map +1 -0
- package/helpers/createElasticsearchQueryBody.d.ts +0 -11
- package/helpers/createElasticsearchQueryBody.js +0 -618
- package/helpers/createElasticsearchQueryBody.js.map +0 -1
- package/helpers/fields.d.ts +0 -19
- package/helpers/fields.js +0 -196
- package/helpers/fields.js.map +0 -1
- package/helpers/searchPluginsList.d.ts +0 -6
- package/helpers/searchPluginsList.js.map +0 -1
- package/helpers/transformValueForSearch.d.ts +0 -12
- package/helpers/transformValueForSearch.js.map +0 -1
package/helpers/fields.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { CmsModel, CmsModelField } from "@webiny/api-headless-cms/types";
|
|
2
|
-
import { PluginsContainer } from "@webiny/plugins";
|
|
3
|
-
declare type ModelFieldPath = string | ((value: string) => string);
|
|
4
|
-
export interface ModelField {
|
|
5
|
-
unmappedType?: string;
|
|
6
|
-
keyword?: boolean;
|
|
7
|
-
isSearchable: boolean;
|
|
8
|
-
isSortable: boolean;
|
|
9
|
-
type: string;
|
|
10
|
-
isSystemField?: boolean;
|
|
11
|
-
field: CmsModelField;
|
|
12
|
-
path?: ModelFieldPath;
|
|
13
|
-
}
|
|
14
|
-
export interface ModelFields {
|
|
15
|
-
[fieldId: string]: ModelField;
|
|
16
|
-
}
|
|
17
|
-
export declare const systemFields: ModelFields;
|
|
18
|
-
export declare const createModelFields: (plugins: PluginsContainer, model: CmsModel) => ModelFields;
|
|
19
|
-
export {};
|
package/helpers/fields.js
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.systemFields = exports.createModelFields = void 0;
|
|
9
|
-
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
13
|
-
|
|
14
|
-
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
15
|
-
|
|
16
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
-
|
|
18
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
19
|
-
|
|
20
|
-
const createSystemField = field => {
|
|
21
|
-
if (!field.storageId) {
|
|
22
|
-
throw new _error.default(`When creating system field it must have a "storageId".`, "SYSTEM_FIELD_ERROR", {
|
|
23
|
-
field
|
|
24
|
-
});
|
|
25
|
-
} else if (!field.fieldId) {
|
|
26
|
-
throw new _error.default(`When creating system field it must have a "fieldId".`, "SYSTEM_FIELD_ERROR", {
|
|
27
|
-
field
|
|
28
|
-
});
|
|
29
|
-
} else if (!field.type) {
|
|
30
|
-
throw new _error.default(`When creating system field it must have a "type".`, "SYSTEM_FIELD_ERROR", {
|
|
31
|
-
field
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return _objectSpread(_objectSpread({}, field), {}, {
|
|
36
|
-
id: field.fieldId,
|
|
37
|
-
label: field.fieldId
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const systemFields = {
|
|
42
|
-
id: {
|
|
43
|
-
type: "text",
|
|
44
|
-
isSystemField: true,
|
|
45
|
-
isSearchable: true,
|
|
46
|
-
isSortable: true,
|
|
47
|
-
field: createSystemField({
|
|
48
|
-
storageId: "id",
|
|
49
|
-
fieldId: "id",
|
|
50
|
-
type: "text"
|
|
51
|
-
})
|
|
52
|
-
},
|
|
53
|
-
entryId: {
|
|
54
|
-
type: "text",
|
|
55
|
-
isSystemField: true,
|
|
56
|
-
isSearchable: true,
|
|
57
|
-
isSortable: true,
|
|
58
|
-
field: createSystemField({
|
|
59
|
-
storageId: "entryId",
|
|
60
|
-
fieldId: "entryId",
|
|
61
|
-
type: "text"
|
|
62
|
-
})
|
|
63
|
-
},
|
|
64
|
-
savedOn: {
|
|
65
|
-
type: "date",
|
|
66
|
-
unmappedType: "date",
|
|
67
|
-
keyword: false,
|
|
68
|
-
isSystemField: true,
|
|
69
|
-
isSearchable: true,
|
|
70
|
-
isSortable: true,
|
|
71
|
-
field: createSystemField({
|
|
72
|
-
storageId: "savedOn",
|
|
73
|
-
fieldId: "savedOn",
|
|
74
|
-
type: "datetime",
|
|
75
|
-
settings: {
|
|
76
|
-
type: "dateTimeWithoutTimezone"
|
|
77
|
-
}
|
|
78
|
-
})
|
|
79
|
-
},
|
|
80
|
-
createdOn: {
|
|
81
|
-
type: "date",
|
|
82
|
-
unmappedType: "date",
|
|
83
|
-
keyword: false,
|
|
84
|
-
isSystemField: true,
|
|
85
|
-
isSearchable: true,
|
|
86
|
-
isSortable: true,
|
|
87
|
-
field: createSystemField({
|
|
88
|
-
storageId: "createdOn",
|
|
89
|
-
fieldId: "createdOn",
|
|
90
|
-
type: "text",
|
|
91
|
-
settings: {
|
|
92
|
-
type: "dateTimeWithoutTimezone"
|
|
93
|
-
}
|
|
94
|
-
})
|
|
95
|
-
},
|
|
96
|
-
createdBy: {
|
|
97
|
-
type: "text",
|
|
98
|
-
unmappedType: undefined,
|
|
99
|
-
isSystemField: true,
|
|
100
|
-
isSearchable: true,
|
|
101
|
-
isSortable: false,
|
|
102
|
-
path: "createdBy.id",
|
|
103
|
-
field: createSystemField({
|
|
104
|
-
storageId: "createdBy",
|
|
105
|
-
fieldId: "createdBy",
|
|
106
|
-
type: "text"
|
|
107
|
-
})
|
|
108
|
-
},
|
|
109
|
-
ownedBy: {
|
|
110
|
-
type: "text",
|
|
111
|
-
unmappedType: undefined,
|
|
112
|
-
isSystemField: true,
|
|
113
|
-
isSearchable: true,
|
|
114
|
-
isSortable: false,
|
|
115
|
-
path: "ownedBy.id",
|
|
116
|
-
field: createSystemField({
|
|
117
|
-
storageId: "ownedBy",
|
|
118
|
-
fieldId: "ownedBy",
|
|
119
|
-
type: "text"
|
|
120
|
-
})
|
|
121
|
-
},
|
|
122
|
-
version: {
|
|
123
|
-
type: "number",
|
|
124
|
-
unmappedType: undefined,
|
|
125
|
-
keyword: false,
|
|
126
|
-
isSystemField: true,
|
|
127
|
-
isSearchable: true,
|
|
128
|
-
isSortable: true,
|
|
129
|
-
field: createSystemField({
|
|
130
|
-
storageId: "version",
|
|
131
|
-
fieldId: "version",
|
|
132
|
-
type: "number"
|
|
133
|
-
})
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
/*
|
|
137
|
-
* Create an object with key fieldType and options for that field
|
|
138
|
-
*/
|
|
139
|
-
|
|
140
|
-
exports.systemFields = systemFields;
|
|
141
|
-
|
|
142
|
-
const createModelFields = (plugins, model) => {
|
|
143
|
-
// collect all unmappedType from elastic plugins
|
|
144
|
-
const unmappedTypes = plugins.byType("cms-model-field-to-elastic-search").reduce((acc, plugin) => {
|
|
145
|
-
if (!plugin.unmappedType) {
|
|
146
|
-
return acc;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
acc[plugin.fieldType] = plugin.unmappedType;
|
|
150
|
-
return acc;
|
|
151
|
-
}, {});
|
|
152
|
-
/**
|
|
153
|
-
* collect all field types from the plugins
|
|
154
|
-
*/
|
|
155
|
-
|
|
156
|
-
const fieldTypePlugins = plugins.byType("cms-model-field-to-graphql").reduce((types, plugin) => {
|
|
157
|
-
const {
|
|
158
|
-
fieldType,
|
|
159
|
-
isSearchable,
|
|
160
|
-
isSortable
|
|
161
|
-
} = plugin;
|
|
162
|
-
types[fieldType] = {
|
|
163
|
-
unmappedType: unmappedTypes[fieldType],
|
|
164
|
-
isSearchable: isSearchable === true,
|
|
165
|
-
isSortable: isSortable === true
|
|
166
|
-
};
|
|
167
|
-
return types;
|
|
168
|
-
}, {});
|
|
169
|
-
return model.fields.reduce((fields, field) => {
|
|
170
|
-
const {
|
|
171
|
-
fieldId,
|
|
172
|
-
type
|
|
173
|
-
} = field;
|
|
174
|
-
|
|
175
|
-
if (!fieldTypePlugins[type]) {
|
|
176
|
-
throw new _error.default(`There is no plugin for field type "${type}".`);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
const {
|
|
180
|
-
isSearchable,
|
|
181
|
-
isSortable,
|
|
182
|
-
unmappedType
|
|
183
|
-
} = fieldTypePlugins[type];
|
|
184
|
-
fields[fieldId] = {
|
|
185
|
-
type,
|
|
186
|
-
isSearchable,
|
|
187
|
-
isSortable,
|
|
188
|
-
unmappedType: typeof unmappedType === "function" ? unmappedType(field) : undefined,
|
|
189
|
-
isSystemField: false,
|
|
190
|
-
field
|
|
191
|
-
};
|
|
192
|
-
return fields;
|
|
193
|
-
}, (0, _cloneDeep.default)(systemFields));
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
exports.createModelFields = createModelFields;
|
package/helpers/fields.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createSystemField","field","storageId","WebinyError","fieldId","type","id","label","systemFields","isSystemField","isSearchable","isSortable","entryId","savedOn","unmappedType","keyword","settings","createdOn","createdBy","undefined","path","ownedBy","version","createModelFields","plugins","model","unmappedTypes","byType","reduce","acc","plugin","fieldType","fieldTypePlugins","types","fields","lodashCloneDeep"],"sources":["fields.ts"],"sourcesContent":["import {\n CmsModel,\n CmsModelField,\n CmsModelFieldToGraphQLPlugin\n} from \"@webiny/api-headless-cms/types\";\nimport WebinyError from \"@webiny/error\";\nimport { CmsModelFieldToElasticsearchPlugin } from \"~/types\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport lodashCloneDeep from \"lodash/cloneDeep\";\n\ntype ModelFieldPath = string | ((value: string) => string);\nexport interface ModelField {\n unmappedType?: string;\n keyword?: boolean;\n isSearchable: boolean;\n isSortable: boolean;\n type: string;\n isSystemField?: boolean;\n field: CmsModelField;\n path?: ModelFieldPath;\n}\n\nexport interface ModelFields {\n [fieldId: string]: ModelField;\n}\n\ntype 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}\ntype FieldTypePlugins = Record<string, FieldTypePlugin>;\n\ntype PartialCmsModelField = Partial<CmsModelField> &\n Pick<CmsModelField, \"storageId\" | \"fieldId\" | \"type\">;\nconst createSystemField = (field: PartialCmsModelField): CmsModelField => {\n if (!field.storageId) {\n throw new WebinyError(\n `When creating system field it must have a \"storageId\".`,\n \"SYSTEM_FIELD_ERROR\",\n {\n field\n }\n );\n } else if (!field.fieldId) {\n throw new WebinyError(\n `When creating system field it must have a \"fieldId\".`,\n \"SYSTEM_FIELD_ERROR\",\n {\n field\n }\n );\n } else if (!field.type) {\n throw new WebinyError(\n `When creating system field it must have a \"type\".`,\n \"SYSTEM_FIELD_ERROR\",\n {\n field\n }\n );\n }\n return {\n ...field,\n id: field.fieldId,\n label: field.fieldId\n };\n};\n\nexport const systemFields: ModelFields = {\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 },\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 },\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 },\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 },\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 },\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 },\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 }\n};\n\n/*\n * Create an object with key fieldType and options for that field\n */\nexport const createModelFields = (plugins: PluginsContainer, model: CmsModel): ModelFields => {\n // collect all unmappedType from elastic plugins\n const unmappedTypes = plugins\n .byType<CmsModelFieldToElasticsearchPlugin>(\"cms-model-field-to-elastic-search\")\n .reduce((acc, plugin) => {\n if (!plugin.unmappedType) {\n return acc;\n }\n acc[plugin.fieldType] = plugin.unmappedType;\n return acc;\n }, {} as UnmappedFieldTypes);\n /**\n * collect all field types from the plugins\n */\n const fieldTypePlugins = plugins\n .byType<CmsModelFieldToGraphQLPlugin>(\"cms-model-field-to-graphql\")\n .reduce((types, plugin) => {\n const { fieldType, isSearchable, isSortable } = plugin;\n types[fieldType] = {\n unmappedType: unmappedTypes[fieldType],\n isSearchable: isSearchable === true,\n isSortable: isSortable === true\n };\n return types;\n }, {} as FieldTypePlugins);\n\n return model.fields.reduce((fields, field) => {\n const { fieldId, type } = field;\n if (!fieldTypePlugins[type]) {\n throw new WebinyError(`There is no plugin for field type \"${type}\".`);\n }\n const { isSearchable, isSortable, unmappedType } = fieldTypePlugins[type];\n fields[fieldId] = {\n type,\n isSearchable,\n isSortable,\n unmappedType: typeof unmappedType === \"function\" ? unmappedType(field) : undefined,\n isSystemField: false,\n field\n };\n\n return fields;\n }, lodashCloneDeep(systemFields));\n};\n"],"mappings":";;;;;;;;;;;AAKA;;AAGA;;;;;;AA+BA,MAAMA,iBAAiB,GAAIC,KAAD,IAAgD;EACtE,IAAI,CAACA,KAAK,CAACC,SAAX,EAAsB;IAClB,MAAM,IAAIC,cAAJ,CACD,wDADC,EAEF,oBAFE,EAGF;MACIF;IADJ,CAHE,CAAN;EAOH,CARD,MAQO,IAAI,CAACA,KAAK,CAACG,OAAX,EAAoB;IACvB,MAAM,IAAID,cAAJ,CACD,sDADC,EAEF,oBAFE,EAGF;MACIF;IADJ,CAHE,CAAN;EAOH,CARM,MAQA,IAAI,CAACA,KAAK,CAACI,IAAX,EAAiB;IACpB,MAAM,IAAIF,cAAJ,CACD,mDADC,EAEF,oBAFE,EAGF;MACIF;IADJ,CAHE,CAAN;EAOH;;EACD,uCACOA,KADP;IAEIK,EAAE,EAAEL,KAAK,CAACG,OAFd;IAGIG,KAAK,EAAEN,KAAK,CAACG;EAHjB;AAKH,CA/BD;;AAiCO,MAAMI,YAAyB,GAAG;EACrCF,EAAE,EAAE;IACAD,IAAI,EAAE,MADN;IAEAI,aAAa,EAAE,IAFf;IAGAC,YAAY,EAAE,IAHd;IAIAC,UAAU,EAAE,IAJZ;IAKAV,KAAK,EAAED,iBAAiB,CAAC;MACrBE,SAAS,EAAE,IADU;MAErBE,OAAO,EAAE,IAFY;MAGrBC,IAAI,EAAE;IAHe,CAAD;EALxB,CADiC;EAYrCO,OAA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AAD,CAAL,GAAmB;MACfjB,YAAY,EAAEY,aAAa,CAACK,SAAD,CADZ;MAEfrB,YAAY,EAAEA,YAAY,KAAK,IAFhB;MAGfC,UAAU,EAAEA,UAAU,KAAK;IAHZ,CAAnB;IAKA,OAAOsB,KAAP;EACH,CAVoB,EAUlB,EAVkB,CAAzB;EAYA,OAAOR,KAAK,CAACS,MAAN,CAAaN,MAAb,CAAoB,CAACM,MAAD,EAASjC,KAAT,KAAmB;IAC1C,MAAM;MAAEG,OAAF;MAAWC;IAAX,IAAoBJ,KAA1B;;IACA,IAAI,CAAC+B,gBAAgB,CAAC3B,IAAD,CAArB,EAA6B;MACzB,MAAM,IAAIF,cAAJ,CAAiB,sCAAqCE,IAAK,IAA3D,CAAN;IACH;;IACD,MAAM;MAAEK,YAAF;MAAgBC,UAAhB;MAA4BG;IAA5B,IAA6CkB,gBAAgB,CAAC3B,IAAD,CAAnE;IACA6B,MAAM,CAAC9B,OAAD,CAAN,GAAkB;MACdC,IADc;MAEdK,YAFc;MAGdC,UAHc;MAIdG,YAAY,EAAE,OAAOA,YAAP,KAAwB,UAAxB,GAAqCA,YAAY,CAACb,KAAD,CAAjD,GAA2DkB,SAJ3D;MAKdV,aAAa,EAAE,KALD;MAMdR;IANc,CAAlB;IASA,OAAOiC,MAAP;EACH,CAhBM,EAgBJ,IAAAC,kBAAA,EAAgB3B,YAAhB,CAhBI,CAAP;AAiBH,CA3CM"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { PluginsContainer } from "@webiny/plugins";
|
|
2
|
-
import { CmsEntryElasticsearchQueryBuilderValueSearchPlugin } from "../plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin";
|
|
3
|
-
export interface ElasticsearchQuerySearchValuePlugins {
|
|
4
|
-
[fieldType: string]: CmsEntryElasticsearchQueryBuilderValueSearchPlugin;
|
|
5
|
-
}
|
|
6
|
-
export declare const searchPluginsList: (plugins: PluginsContainer) => ElasticsearchQuerySearchValuePlugins;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["searchPluginsList","plugins","byType","reduce","plugin","fieldType","WebinyError","name"],"sources":["searchPluginsList.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { CmsEntryElasticsearchQueryBuilderValueSearchPlugin } from \"~/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin\";\n\nexport interface ElasticsearchQuerySearchValuePlugins {\n [fieldType: string]: CmsEntryElasticsearchQueryBuilderValueSearchPlugin;\n}\n\nexport const searchPluginsList = (\n plugins: PluginsContainer\n): ElasticsearchQuerySearchValuePlugins => {\n return plugins\n .byType<CmsEntryElasticsearchQueryBuilderValueSearchPlugin>(\n \"cms-elastic-search-query-builder-value-search\"\n )\n .reduce((plugins, plugin) => {\n if (plugins[plugin.fieldType]) {\n throw new WebinyError(\n \"There is a ElasticsearchQueryBuilderValueSearchPlugin defined for the field type.\",\n \"PLUGIN_ALREADY_EXISTS\",\n {\n fieldType: plugin.fieldType,\n name: plugin.name || \"unknown\"\n }\n );\n }\n plugins[plugin.fieldType] = plugin;\n\n return plugins;\n }, {} as ElasticsearchQuerySearchValuePlugins);\n};\n"],"mappings":";;;;;;;;;AAAA;;AAQO,MAAMA,iBAAiB,GAC1BC,OAD6B,IAEU;EACvC,OAAOA,OAAO,CACTC,MADE,CAEC,+CAFD,EAIFC,MAJE,CAIK,CAACF,OAAD,EAAUG,MAAV,KAAqB;IACzB,IAAIH,OAAO,CAACG,MAAM,CAACC,SAAR,CAAX,EAA+B;MAC3B,MAAM,IAAIC,cAAJ,CACF,mFADE,EAEF,uBAFE,EAGF;QACID,SAAS,EAAED,MAAM,CAACC,SADtB;QAEIE,IAAI,EAAEH,MAAM,CAACG,IAAP,IAAe;MAFzB,CAHE,CAAN;IAQH;;IACDN,OAAO,CAACG,MAAM,CAACC,SAAR,CAAP,GAA4BD,MAA5B;IAEA,OAAOH,OAAP;EACH,CAlBE,EAkBA,EAlBA,CAAP;AAmBH,CAtBM"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ElasticsearchQuerySearchValuePlugins } from "./searchPluginsList";
|
|
2
|
-
import { CmsModelField } from "@webiny/api-headless-cms/types";
|
|
3
|
-
interface TransformValueForSearchParams {
|
|
4
|
-
plugins: ElasticsearchQuerySearchValuePlugins;
|
|
5
|
-
field: CmsModelField;
|
|
6
|
-
value: any;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Transformed can be anything.
|
|
10
|
-
*/
|
|
11
|
-
export declare const transformValueForSearch: (args: TransformValueForSearchParams) => any;
|
|
12
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["transformValueForSearch","args","field","plugins","value","plugin","type","transform"],"sources":["transformValueForSearch.ts"],"sourcesContent":["import { ElasticsearchQuerySearchValuePlugins } from \"./searchPluginsList\";\nimport { CmsModelField } from \"@webiny/api-headless-cms/types\";\n\ninterface TransformValueForSearchParams {\n plugins: ElasticsearchQuerySearchValuePlugins;\n field: CmsModelField;\n value: any;\n}\n\n/**\n * Transformed can be anything.\n */\nexport const transformValueForSearch = (args: TransformValueForSearchParams): any => {\n const { field, plugins, value } = args;\n const plugin = plugins[field.type];\n if (!plugin) {\n return value;\n }\n return plugin.transform({ field, value });\n};\n"],"mappings":";;;;;;;AASA;AACA;AACA;AACO,MAAMA,uBAAuB,GAAIC,IAAD,IAA8C;EACjF,MAAM;IAAEC,KAAF;IAASC,OAAT;IAAkBC;EAAlB,IAA4BH,IAAlC;EACA,MAAMI,MAAM,GAAGF,OAAO,CAACD,KAAK,CAACI,IAAP,CAAtB;;EACA,IAAI,CAACD,MAAL,EAAa;IACT,OAAOD,KAAP;EACH;;EACD,OAAOC,MAAM,CAACE,SAAP,CAAiB;IAAEL,KAAF;IAASE;EAAT,CAAjB,CAAP;AACH,CAPM"}
|