@webiny/api-headless-cms-ddb-es 0.0.0-unstable.40876133bb → 0.0.0-unstable.496cf268ac

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.
Files changed (204) hide show
  1. package/configurations.js +0 -8
  2. package/configurations.js.map +1 -1
  3. package/definitions/entry.js +3 -5
  4. package/definitions/entry.js.map +1 -1
  5. package/definitions/entryElasticsearch.js +0 -5
  6. package/definitions/entryElasticsearch.js.map +1 -1
  7. package/definitions/group.js +0 -5
  8. package/definitions/group.js.map +1 -1
  9. package/definitions/model.js +22 -5
  10. package/definitions/model.js.map +1 -1
  11. package/definitions/settings.js +0 -5
  12. package/definitions/settings.js.map +1 -1
  13. package/definitions/system.js +0 -5
  14. package/definitions/system.js.map +1 -1
  15. package/definitions/table.js +0 -3
  16. package/definitions/table.js.map +1 -1
  17. package/definitions/tableElasticsearch.js +0 -3
  18. package/definitions/tableElasticsearch.js.map +1 -1
  19. package/dynamoDb/index.d.ts +1 -1
  20. package/dynamoDb/index.js +0 -5
  21. package/dynamoDb/index.js.map +1 -1
  22. package/dynamoDb/storage/date.d.ts +2 -1
  23. package/dynamoDb/storage/date.js +4 -17
  24. package/dynamoDb/storage/date.js.map +1 -1
  25. package/dynamoDb/storage/longText.d.ts +1 -1
  26. package/dynamoDb/storage/longText.js +10 -18
  27. package/dynamoDb/storage/longText.js.map +1 -1
  28. package/dynamoDb/storage/richText.d.ts +1 -1
  29. package/dynamoDb/storage/richText.js +12 -30
  30. package/dynamoDb/storage/richText.js.map +1 -1
  31. package/elasticsearch/createElasticsearchIndex.js +0 -11
  32. package/elasticsearch/createElasticsearchIndex.js.map +1 -1
  33. package/elasticsearch/deleteElasticsearchIndex.js +0 -7
  34. package/elasticsearch/deleteElasticsearchIndex.js.map +1 -1
  35. package/elasticsearch/index.js +0 -5
  36. package/elasticsearch/index.js.map +1 -1
  37. package/elasticsearch/indexing/dateTimeIndexing.js +4 -21
  38. package/elasticsearch/indexing/dateTimeIndexing.js.map +1 -1
  39. package/elasticsearch/indexing/defaultFieldIndexing.js +15 -10
  40. package/elasticsearch/indexing/defaultFieldIndexing.js.map +1 -1
  41. package/elasticsearch/indexing/index.js +0 -9
  42. package/elasticsearch/indexing/index.js.map +1 -1
  43. package/elasticsearch/indexing/longTextIndexing.d.ts +4 -0
  44. package/elasticsearch/indexing/longTextIndexing.js +19 -9
  45. package/elasticsearch/indexing/longTextIndexing.js.map +1 -1
  46. package/elasticsearch/indexing/numberIndexing.js +0 -9
  47. package/elasticsearch/indexing/numberIndexing.js.map +1 -1
  48. package/elasticsearch/indexing/objectIndexing.js +3 -30
  49. package/elasticsearch/indexing/objectIndexing.js.map +1 -1
  50. package/elasticsearch/indexing/richTextIndexing.js +0 -5
  51. package/elasticsearch/indexing/richTextIndexing.js.map +1 -1
  52. package/elasticsearch/indices/base.js +0 -3
  53. package/elasticsearch/indices/base.js.map +1 -1
  54. package/elasticsearch/indices/index.js +0 -4
  55. package/elasticsearch/indices/index.js.map +1 -1
  56. package/elasticsearch/indices/japanese.js +0 -3
  57. package/elasticsearch/indices/japanese.js.map +1 -1
  58. package/elasticsearch/search/index.js +0 -4
  59. package/elasticsearch/search/index.js.map +1 -1
  60. package/elasticsearch/search/refSearch.js +4 -8
  61. package/elasticsearch/search/refSearch.js.map +1 -1
  62. package/elasticsearch/search/timeSearch.js +0 -7
  63. package/elasticsearch/search/timeSearch.js.map +1 -1
  64. package/helpers/entryIndexHelpers.js +20 -49
  65. package/helpers/entryIndexHelpers.js.map +1 -1
  66. package/helpers/index.d.ts +0 -1
  67. package/helpers/index.js +0 -15
  68. package/helpers/index.js.map +1 -1
  69. package/index.js +19 -73
  70. package/index.js.map +1 -1
  71. package/operations/entry/dataLoaders.js +0 -52
  72. package/operations/entry/dataLoaders.js.map +1 -1
  73. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +18 -0
  74. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +32 -0
  75. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +1 -0
  76. package/operations/entry/elasticsearch/body.d.ts +13 -0
  77. package/operations/entry/elasticsearch/body.js +140 -0
  78. package/operations/entry/elasticsearch/body.js.map +1 -0
  79. package/operations/entry/elasticsearch/fields.d.ts +9 -0
  80. package/operations/entry/elasticsearch/fields.js +229 -0
  81. package/operations/entry/elasticsearch/fields.js.map +1 -0
  82. package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +8 -0
  83. package/operations/entry/elasticsearch/filtering/applyFiltering.js +57 -0
  84. package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +1 -0
  85. package/operations/entry/elasticsearch/filtering/exec.d.ts +17 -0
  86. package/operations/entry/elasticsearch/filtering/exec.js +172 -0
  87. package/operations/entry/elasticsearch/filtering/exec.js.map +1 -0
  88. package/operations/entry/elasticsearch/filtering/index.d.ts +1 -0
  89. package/operations/entry/elasticsearch/filtering/index.js +16 -0
  90. package/operations/entry/elasticsearch/filtering/index.js.map +1 -0
  91. package/operations/entry/elasticsearch/filtering/path.d.ts +15 -0
  92. package/operations/entry/elasticsearch/filtering/path.js +44 -0
  93. package/operations/entry/elasticsearch/filtering/path.js.map +1 -0
  94. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.d.ts +2 -0
  95. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +28 -0
  96. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +1 -0
  97. package/operations/entry/elasticsearch/filtering/plugins/index.d.ts +1 -0
  98. package/operations/entry/elasticsearch/filtering/plugins/index.js +13 -0
  99. package/operations/entry/elasticsearch/filtering/plugins/index.js.map +1 -0
  100. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.d.ts +2 -0
  101. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +65 -0
  102. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +1 -0
  103. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.d.ts +2 -0
  104. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +48 -0
  105. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +1 -0
  106. package/operations/entry/elasticsearch/filtering/populated.d.ts +2 -0
  107. package/operations/entry/elasticsearch/filtering/populated.js +23 -0
  108. package/operations/entry/elasticsearch/filtering/populated.js.map +1 -0
  109. package/operations/entry/elasticsearch/filtering/values.d.ts +2 -0
  110. package/operations/entry/elasticsearch/filtering/values.js +22 -0
  111. package/operations/entry/elasticsearch/filtering/values.js.map +1 -0
  112. package/operations/entry/elasticsearch/fullTextSearch.d.ts +12 -0
  113. package/operations/entry/elasticsearch/fullTextSearch.js +89 -0
  114. package/operations/entry/elasticsearch/fullTextSearch.js.map +1 -0
  115. package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +8 -0
  116. package/operations/entry/elasticsearch/fullTextSearchFields.js +25 -0
  117. package/operations/entry/elasticsearch/fullTextSearchFields.js.map +1 -0
  118. package/operations/entry/elasticsearch/initialQuery.d.ts +17 -0
  119. package/operations/entry/elasticsearch/initialQuery.js +103 -0
  120. package/operations/entry/elasticsearch/initialQuery.js.map +1 -0
  121. package/operations/entry/elasticsearch/keyword.d.ts +2 -0
  122. package/operations/entry/elasticsearch/keyword.js +34 -0
  123. package/operations/entry/elasticsearch/keyword.js.map +1 -0
  124. package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +9 -0
  125. package/operations/entry/elasticsearch/plugins/bodyModifier.js +16 -0
  126. package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +1 -0
  127. package/operations/entry/elasticsearch/plugins/operator.d.ts +8 -0
  128. package/operations/entry/elasticsearch/plugins/operator.js +37 -0
  129. package/operations/entry/elasticsearch/plugins/operator.js.map +1 -0
  130. package/operations/entry/elasticsearch/plugins/queryModifier.d.ts +9 -0
  131. package/operations/entry/elasticsearch/plugins/queryModifier.js +16 -0
  132. package/operations/entry/elasticsearch/plugins/queryModifier.js.map +1 -0
  133. package/operations/entry/elasticsearch/plugins/search.d.ts +7 -0
  134. package/{helpers/searchPluginsList.js → operations/entry/elasticsearch/plugins/search.js} +7 -9
  135. package/operations/entry/elasticsearch/plugins/search.js.map +1 -0
  136. package/operations/entry/elasticsearch/plugins/sortModifier.d.ts +9 -0
  137. package/operations/entry/elasticsearch/plugins/sortModifier.js +16 -0
  138. package/operations/entry/elasticsearch/plugins/sortModifier.js.map +1 -0
  139. package/operations/entry/elasticsearch/sort.d.ts +12 -0
  140. package/operations/entry/elasticsearch/sort.js +82 -0
  141. package/operations/entry/elasticsearch/sort.js.map +1 -0
  142. package/operations/entry/elasticsearch/transformValueForSearch.d.ts +16 -0
  143. package/{helpers → operations/entry/elasticsearch}/transformValueForSearch.js +7 -6
  144. package/operations/entry/elasticsearch/transformValueForSearch.js.map +1 -0
  145. package/operations/entry/elasticsearch/types.d.ts +41 -0
  146. package/operations/entry/elasticsearch/types.js +5 -0
  147. package/operations/entry/elasticsearch/types.js.map +1 -0
  148. package/operations/entry/index.d.ts +0 -2
  149. package/operations/entry/index.js +72 -210
  150. package/operations/entry/index.js.map +1 -1
  151. package/operations/entry/keys.js +0 -9
  152. package/operations/entry/keys.js.map +1 -1
  153. package/operations/entry/recordType.d.ts +3 -0
  154. package/operations/entry/recordType.js +18 -0
  155. package/operations/entry/recordType.js.map +1 -0
  156. package/operations/group/index.js +2 -32
  157. package/operations/group/index.js.map +1 -1
  158. package/operations/model/index.js +1 -34
  159. package/operations/model/index.js.map +1 -1
  160. package/operations/settings/index.js +0 -24
  161. package/operations/settings/index.js.map +1 -1
  162. package/operations/system/index.js +0 -17
  163. package/operations/system/index.js.map +1 -1
  164. package/package.json +16 -16
  165. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +1 -0
  166. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +6 -8
  167. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +1 -1
  168. package/plugins/CmsEntryElasticsearchFieldPlugin.js +0 -6
  169. package/plugins/CmsEntryElasticsearchFieldPlugin.js.map +1 -1
  170. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.d.ts +23 -0
  171. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +28 -0
  172. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js.map +1 -0
  173. package/plugins/CmsEntryElasticsearchIndexPlugin.js +0 -5
  174. package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +1 -1
  175. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +1 -0
  176. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +6 -12
  177. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +1 -1
  178. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +1 -0
  179. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +6 -8
  180. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +1 -1
  181. package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +1 -0
  182. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +6 -8
  183. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +1 -1
  184. package/plugins/CmsEntryFilterPlugin.d.ts +49 -0
  185. package/plugins/CmsEntryFilterPlugin.js +24 -0
  186. package/plugins/CmsEntryFilterPlugin.js.map +1 -0
  187. package/plugins/index.d.ts +1 -0
  188. package/plugins/index.js +11 -12
  189. package/plugins/index.js.map +1 -1
  190. package/types.js +0 -5
  191. package/types.js.map +1 -1
  192. package/helpers/createElasticsearchQueryBody.d.ts +0 -11
  193. package/helpers/createElasticsearchQueryBody.js +0 -611
  194. package/helpers/createElasticsearchQueryBody.js.map +0 -1
  195. package/helpers/fields.d.ts +0 -19
  196. package/helpers/fields.js +0 -205
  197. package/helpers/fields.js.map +0 -1
  198. package/helpers/searchPluginsList.d.ts +0 -6
  199. package/helpers/searchPluginsList.js.map +0 -1
  200. package/helpers/transformValueForSearch.d.ts +0 -12
  201. package/helpers/transformValueForSearch.js.map +0 -1
  202. package/operations/entry/elasticsearchFields.d.ts +0 -2
  203. package/operations/entry/elasticsearchFields.js +0 -38
  204. package/operations/entry/elasticsearchFields.js.map +0 -1
@@ -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,205 +0,0 @@
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.systemFields = exports.createModelFields = void 0;
9
-
10
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
- var _error = _interopRequireDefault(require("@webiny/error"));
13
-
14
- var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
15
-
16
- const createSystemField = field => {
17
- if (!field.storageId) {
18
- throw new _error.default(`When creating system field it must have a "storageId".`, "SYSTEM_FIELD_ERROR", {
19
- field
20
- });
21
- } else if (!field.fieldId) {
22
- throw new _error.default(`When creating system field it must have a "fieldId".`, "SYSTEM_FIELD_ERROR", {
23
- field
24
- });
25
- } else if (!field.type) {
26
- throw new _error.default(`When creating system field it must have a "type".`, "SYSTEM_FIELD_ERROR", {
27
- field
28
- });
29
- }
30
-
31
- return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, field), {}, {
32
- id: field.fieldId,
33
- label: field.fieldId
34
- });
35
- };
36
-
37
- const systemFields = {
38
- id: {
39
- type: "text",
40
- isSystemField: true,
41
- isSearchable: true,
42
- isSortable: true,
43
- field: createSystemField({
44
- storageId: "id",
45
- fieldId: "id",
46
- type: "text"
47
- })
48
- },
49
- entryId: {
50
- type: "text",
51
- isSystemField: true,
52
- isSearchable: true,
53
- isSortable: true,
54
- field: createSystemField({
55
- storageId: "entryId",
56
- fieldId: "entryId",
57
- type: "text"
58
- })
59
- },
60
- savedOn: {
61
- type: "date",
62
- unmappedType: "date",
63
- keyword: false,
64
- isSystemField: true,
65
- isSearchable: true,
66
- isSortable: true,
67
- field: createSystemField({
68
- storageId: "savedOn",
69
- fieldId: "savedOn",
70
- type: "datetime",
71
- settings: {
72
- type: "dateTimeWithoutTimezone"
73
- }
74
- })
75
- },
76
- createdOn: {
77
- type: "date",
78
- unmappedType: "date",
79
- keyword: false,
80
- isSystemField: true,
81
- isSearchable: true,
82
- isSortable: true,
83
- field: createSystemField({
84
- storageId: "createdOn",
85
- fieldId: "createdOn",
86
- type: "text",
87
- settings: {
88
- type: "dateTimeWithoutTimezone"
89
- }
90
- })
91
- },
92
- createdBy: {
93
- type: "text",
94
- unmappedType: undefined,
95
- isSystemField: true,
96
- isSearchable: true,
97
- isSortable: false,
98
- path: "createdBy.id",
99
- field: createSystemField({
100
- storageId: "createdBy",
101
- fieldId: "createdBy",
102
- type: "text"
103
- })
104
- },
105
- ownedBy: {
106
- type: "text",
107
- unmappedType: undefined,
108
- isSystemField: true,
109
- isSearchable: true,
110
- isSortable: false,
111
- path: "ownedBy.id",
112
- field: createSystemField({
113
- storageId: "ownedBy",
114
- fieldId: "ownedBy",
115
- type: "text"
116
- })
117
- },
118
- version: {
119
- type: "number",
120
- unmappedType: undefined,
121
- keyword: false,
122
- isSystemField: true,
123
- isSearchable: true,
124
- isSortable: true,
125
- field: createSystemField({
126
- storageId: "version",
127
- fieldId: "version",
128
- type: "number"
129
- })
130
- },
131
- status: {
132
- type: "string",
133
- unmappedType: undefined,
134
- keyword: false,
135
- isSystemField: true,
136
- isSearchable: true,
137
- isSortable: false,
138
- field: createSystemField({
139
- storageId: "status",
140
- fieldId: "status",
141
- type: "string"
142
- })
143
- }
144
- };
145
- /*
146
- * Create an object with key fieldType and options for that field
147
- */
148
-
149
- exports.systemFields = systemFields;
150
-
151
- const createModelFields = (plugins, model) => {
152
- // collect all unmappedType from elastic plugins
153
- const unmappedTypes = plugins.byType("cms-model-field-to-elastic-search").reduce((acc, plugin) => {
154
- if (!plugin.unmappedType) {
155
- return acc;
156
- }
157
-
158
- acc[plugin.fieldType] = plugin.unmappedType;
159
- return acc;
160
- }, {});
161
- /**
162
- * collect all field types from the plugins
163
- */
164
-
165
- const fieldTypePlugins = plugins.byType("cms-model-field-to-graphql").reduce((types, plugin) => {
166
- const {
167
- fieldType,
168
- isSearchable,
169
- isSortable
170
- } = plugin;
171
- types[fieldType] = {
172
- unmappedType: unmappedTypes[fieldType],
173
- isSearchable,
174
- isSortable
175
- };
176
- return types;
177
- }, {});
178
- return model.fields.reduce((fields, field) => {
179
- const {
180
- fieldId,
181
- type
182
- } = field;
183
-
184
- if (!fieldTypePlugins[type]) {
185
- throw new _error.default(`There is no plugin for field type "${type}".`);
186
- }
187
-
188
- const {
189
- isSearchable,
190
- isSortable,
191
- unmappedType
192
- } = fieldTypePlugins[type];
193
- fields[fieldId] = {
194
- type,
195
- isSearchable,
196
- isSortable,
197
- unmappedType: typeof unmappedType === "function" ? unmappedType(field) : undefined,
198
- isSystemField: false,
199
- field
200
- };
201
- return fields;
202
- }, (0, _cloneDeep.default)(systemFields));
203
- };
204
-
205
- exports.createModelFields = createModelFields;
@@ -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","status","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 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 }\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,\n isSortable\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,mEACOA,KADP;IAEIK,EAAE,EAAEL,KAAK,CAACG,OAFd;IAGIG,KAAK,EAAEN,KAAK,CAACG;EAHjB;AAKH,CA/BD;;AAiCO,MA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CAACb,KAAD,CAAjD,GAA2DkB,SAJ3D;MAKdV,aAAa,EAAE,KALD;MAMdR;IANc,CAAlB;IASA,OAAOkC,MAAP;EACH,CAhBM,EAgBJ,IAAAC,kBAAA,EAAgB5B,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"}
@@ -1,2 +0,0 @@
1
- import { CmsEntryElasticsearchFieldPlugin } from "../../plugins/CmsEntryElasticsearchFieldPlugin";
2
- export declare const elasticsearchFields: CmsEntryElasticsearchFieldPlugin[];
@@ -1,38 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.elasticsearchFields = void 0;
7
-
8
- var _CmsEntryElasticsearchFieldPlugin = require("../../plugins/CmsEntryElasticsearchFieldPlugin");
9
-
10
- const elasticsearchFields = [new _CmsEntryElasticsearchFieldPlugin.CmsEntryElasticsearchFieldPlugin({
11
- field: "createdOn",
12
- unmappedType: "date"
13
- }), new _CmsEntryElasticsearchFieldPlugin.CmsEntryElasticsearchFieldPlugin({
14
- field: "savedOn",
15
- unmappedType: "date"
16
- }), new _CmsEntryElasticsearchFieldPlugin.CmsEntryElasticsearchFieldPlugin({
17
- field: "publishedOn",
18
- unmappedType: "date"
19
- }), new _CmsEntryElasticsearchFieldPlugin.CmsEntryElasticsearchFieldPlugin({
20
- field: "ownedBy",
21
- path: "ownedBy.id"
22
- }), new _CmsEntryElasticsearchFieldPlugin.CmsEntryElasticsearchFieldPlugin({
23
- field: "createdBy",
24
- path: "createdBy.id"
25
- }), new _CmsEntryElasticsearchFieldPlugin.CmsEntryElasticsearchFieldPlugin({
26
- field: "version",
27
- path: "version"
28
- }), new _CmsEntryElasticsearchFieldPlugin.CmsEntryElasticsearchFieldPlugin({
29
- field: "status",
30
- path: "status"
31
- }),
32
- /**
33
- * Always add the ALL fields plugin because of the keyword/path build.
34
- */
35
- new _CmsEntryElasticsearchFieldPlugin.CmsEntryElasticsearchFieldPlugin({
36
- field: _CmsEntryElasticsearchFieldPlugin.CmsEntryElasticsearchFieldPlugin.ALL
37
- })];
38
- exports.elasticsearchFields = elasticsearchFields;
@@ -1 +0,0 @@
1
- {"version":3,"names":["elasticsearchFields","CmsEntryElasticsearchFieldPlugin","field","unmappedType","path","ALL"],"sources":["elasticsearchFields.ts"],"sourcesContent":["import { CmsEntryElasticsearchFieldPlugin } from \"~/plugins/CmsEntryElasticsearchFieldPlugin\";\n\nexport const elasticsearchFields = [\n new CmsEntryElasticsearchFieldPlugin({\n field: \"createdOn\",\n unmappedType: \"date\"\n }),\n new CmsEntryElasticsearchFieldPlugin({\n field: \"savedOn\",\n unmappedType: \"date\"\n }),\n new CmsEntryElasticsearchFieldPlugin({\n field: \"publishedOn\",\n unmappedType: \"date\"\n }),\n new CmsEntryElasticsearchFieldPlugin({\n field: \"ownedBy\",\n path: \"ownedBy.id\"\n }),\n new CmsEntryElasticsearchFieldPlugin({\n field: \"createdBy\",\n path: \"createdBy.id\"\n }),\n new CmsEntryElasticsearchFieldPlugin({\n field: \"version\",\n path: \"version\"\n }),\n new CmsEntryElasticsearchFieldPlugin({\n field: \"status\",\n path: \"status\"\n }),\n /**\n * Always add the ALL fields plugin because of the keyword/path build.\n */\n new CmsEntryElasticsearchFieldPlugin({\n field: CmsEntryElasticsearchFieldPlugin.ALL\n })\n];\n"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,mBAAmB,GAAG,CAC/B,IAAIC,kEAAJ,CAAqC;EACjCC,KAAK,EAAE,WAD0B;EAEjCC,YAAY,EAAE;AAFmB,CAArC,CAD+B,EAK/B,IAAIF,kEAAJ,CAAqC;EACjCC,KAAK,EAAE,SAD0B;EAEjCC,YAAY,EAAE;AAFmB,CAArC,CAL+B,EAS/B,IAAIF,kEAAJ,CAAqC;EACjCC,KAAK,EAAE,aAD0B;EAEjCC,YAAY,EAAE;AAFmB,CAArC,CAT+B,EAa/B,IAAIF,kEAAJ,CAAqC;EACjCC,KAAK,EAAE,SAD0B;EAEjCE,IAAI,EAAE;AAF2B,CAArC,CAb+B,EAiB/B,IAAIH,kEAAJ,CAAqC;EACjCC,KAAK,EAAE,WAD0B;EAEjCE,IAAI,EAAE;AAF2B,CAArC,CAjB+B,EAqB/B,IAAIH,kEAAJ,CAAqC;EACjCC,KAAK,EAAE,SAD0B;EAEjCE,IAAI,EAAE;AAF2B,CAArC,CArB+B,EAyB/B,IAAIH,kEAAJ,CAAqC;EACjCC,KAAK,EAAE,QAD0B;EAEjCE,IAAI,EAAE;AAF2B,CAArC,CAzB+B;AA6B/B;AACJ;AACA;AACI,IAAIH,kEAAJ,CAAqC;EACjCC,KAAK,EAAED,kEAAA,CAAiCI;AADP,CAArC,CAhC+B,CAA5B"}