@webiny/api-headless-cms-ddb-es 6.3.0-beta.4 → 6.4.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/configurations.js +27 -35
  2. package/configurations.js.map +1 -1
  3. package/definitions/entry.js +7 -9
  4. package/definitions/entry.js.map +1 -1
  5. package/definitions/group.js +7 -9
  6. package/definitions/group.js.map +1 -1
  7. package/definitions/model.js +7 -9
  8. package/definitions/model.js.map +1 -1
  9. package/definitions/types.d.ts +1 -0
  10. package/definitions/types.js +0 -3
  11. package/elasticsearch/createElasticsearchIndex.js +50 -67
  12. package/elasticsearch/createElasticsearchIndex.js.map +1 -1
  13. package/elasticsearch/deleteElasticsearchIndex.js +18 -26
  14. package/elasticsearch/deleteElasticsearchIndex.js.map +1 -1
  15. package/exports/api/cms/opensearch.js +2 -4
  16. package/feature.js +144 -153
  17. package/feature.js.map +1 -1
  18. package/features/CmsEntryOpenSearchBodyModifier/abstractions.js +2 -1
  19. package/features/CmsEntryOpenSearchBodyModifier/abstractions.js.map +1 -1
  20. package/features/CmsEntryOpenSearchBodyModifier/index.js +0 -2
  21. package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js +28 -27
  22. package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js.map +1 -1
  23. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js +2 -1
  24. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js.map +1 -1
  25. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.js +2 -1
  26. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.js.map +1 -1
  27. package/features/CmsEntryOpenSearchFieldIndex/constants.js +2 -1
  28. package/features/CmsEntryOpenSearchFieldIndex/constants.js.map +1 -1
  29. package/features/CmsEntryOpenSearchFieldIndex/feature.js +13 -12
  30. package/features/CmsEntryOpenSearchFieldIndex/feature.js.map +1 -1
  31. package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.js +48 -65
  32. package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.js.map +1 -1
  33. package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js +20 -30
  34. package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js.map +1 -1
  35. package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.js +15 -16
  36. package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.js.map +1 -1
  37. package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.js +15 -18
  38. package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.js.map +1 -1
  39. package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.js +24 -29
  40. package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.js.map +1 -1
  41. package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js +99 -144
  42. package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js.map +1 -1
  43. package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.js +15 -16
  44. package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.js.map +1 -1
  45. package/features/CmsEntryOpenSearchFieldIndex/index.js +0 -2
  46. package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.js +26 -28
  47. package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.js.map +1 -1
  48. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.js +2 -1
  49. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.js.map +1 -1
  50. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.js +2 -1
  51. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.js.map +1 -1
  52. package/features/CmsEntryOpenSearchFilter/constants.js +2 -1
  53. package/features/CmsEntryOpenSearchFilter/constants.js.map +1 -1
  54. package/features/CmsEntryOpenSearchFilter/feature.js +9 -8
  55. package/features/CmsEntryOpenSearchFilter/feature.js.map +1 -1
  56. package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.js +18 -15
  57. package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.js.map +1 -1
  58. package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.js +35 -53
  59. package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.js.map +1 -1
  60. package/features/CmsEntryOpenSearchFilter/fields/RefFilter.js +27 -40
  61. package/features/CmsEntryOpenSearchFilter/fields/RefFilter.js.map +1 -1
  62. package/features/CmsEntryOpenSearchFilter/index.js +0 -2
  63. package/features/CmsEntryOpenSearchFullTextSearch/abstractions.js +2 -1
  64. package/features/CmsEntryOpenSearchFullTextSearch/abstractions.js.map +1 -1
  65. package/features/CmsEntryOpenSearchFullTextSearch/index.js +0 -2
  66. package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.js +10 -9
  67. package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.js.map +1 -1
  68. package/features/CmsEntryOpenSearchIndex/abstractions.js +2 -1
  69. package/features/CmsEntryOpenSearchIndex/abstractions.js.map +1 -1
  70. package/features/CmsEntryOpenSearchIndex/feature.js +6 -5
  71. package/features/CmsEntryOpenSearchIndex/feature.js.map +1 -1
  72. package/features/CmsEntryOpenSearchIndex/index.js +0 -2
  73. package/features/CmsEntryOpenSearchQueryModifier/abstractions.js +2 -1
  74. package/features/CmsEntryOpenSearchQueryModifier/abstractions.js.map +1 -1
  75. package/features/CmsEntryOpenSearchQueryModifier/index.js +0 -2
  76. package/features/CmsEntryOpenSearchSortModifier/abstractions.js +2 -1
  77. package/features/CmsEntryOpenSearchSortModifier/abstractions.js.map +1 -1
  78. package/features/CmsEntryOpenSearchSortModifier/index.js +0 -2
  79. package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.js +24 -20
  80. package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.js.map +1 -1
  81. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.js +2 -1
  82. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.js.map +1 -1
  83. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.js +2 -1
  84. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.js.map +1 -1
  85. package/features/CmsEntryOpenSearchValueSearch/feature.js +9 -8
  86. package/features/CmsEntryOpenSearchValueSearch/feature.js.map +1 -1
  87. package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.js +14 -16
  88. package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.js.map +1 -1
  89. package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.js +31 -42
  90. package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.js.map +1 -1
  91. package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.js +15 -17
  92. package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.js.map +1 -1
  93. package/features/CmsEntryOpenSearchValueSearch/index.js +0 -2
  94. package/features/CmsEntryOpenSearchValuesModifier/abstractions.js +2 -1
  95. package/features/CmsEntryOpenSearchValuesModifier/abstractions.js.map +1 -1
  96. package/features/CmsEntryOpenSearchValuesModifier/index.js +0 -2
  97. package/helpers/entryIndexHelpers.js +71 -123
  98. package/helpers/entryIndexHelpers.js.map +1 -1
  99. package/helpers/fieldIdentifier.js +18 -30
  100. package/helpers/fieldIdentifier.js.map +1 -1
  101. package/helpers/index.js +0 -2
  102. package/index.js +0 -2
  103. package/operations/entry/dataLoader/DataLoaderCache.js +22 -26
  104. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
  105. package/operations/entry/dataLoader/constants.js +2 -1
  106. package/operations/entry/dataLoader/constants.js.map +1 -1
  107. package/operations/entry/dataLoader/createBatchScheduleFn.js +6 -15
  108. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
  109. package/operations/entry/dataLoader/getAllEntryRevisions.js +18 -29
  110. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
  111. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +27 -37
  112. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
  113. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +27 -37
  114. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
  115. package/operations/entry/dataLoader/getRevisionById.js +32 -46
  116. package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
  117. package/operations/entry/dataLoader/index.js +8 -9
  118. package/operations/entry/dataLoader/index.js.map +1 -1
  119. package/operations/entry/dataLoader/types.js +0 -3
  120. package/operations/entry/dataLoaders.js +81 -99
  121. package/operations/entry/dataLoaders.js.map +1 -1
  122. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +6 -24
  123. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +1 -1
  124. package/operations/entry/elasticsearch/body.js +74 -125
  125. package/operations/entry/elasticsearch/body.js.map +1 -1
  126. package/operations/entry/elasticsearch/fields/createSystemField.js +6 -7
  127. package/operations/entry/elasticsearch/fields/createSystemField.js.map +1 -1
  128. package/operations/entry/elasticsearch/fields/live.js +45 -40
  129. package/operations/entry/elasticsearch/fields/live.js.map +1 -1
  130. package/operations/entry/elasticsearch/fields/location.js +45 -40
  131. package/operations/entry/elasticsearch/fields/location.js.map +1 -1
  132. package/operations/entry/elasticsearch/fields/state.js +99 -88
  133. package/operations/entry/elasticsearch/fields/state.js.map +1 -1
  134. package/operations/entry/elasticsearch/fields.js +193 -217
  135. package/operations/entry/elasticsearch/fields.js.map +1 -1
  136. package/operations/entry/elasticsearch/filtering/applyFiltering.js +32 -45
  137. package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +1 -1
  138. package/operations/entry/elasticsearch/filtering/exec.js +85 -114
  139. package/operations/entry/elasticsearch/filtering/exec.js.map +1 -1
  140. package/operations/entry/elasticsearch/filtering/index.js +0 -2
  141. package/operations/entry/elasticsearch/filtering/path.js +24 -33
  142. package/operations/entry/elasticsearch/filtering/path.js.map +1 -1
  143. package/operations/entry/elasticsearch/filtering/populated.js +8 -14
  144. package/operations/entry/elasticsearch/filtering/populated.js.map +1 -1
  145. package/operations/entry/elasticsearch/filtering/values.js +11 -12
  146. package/operations/entry/elasticsearch/filtering/values.js.map +1 -1
  147. package/operations/entry/elasticsearch/fullTextSearch.js +43 -80
  148. package/operations/entry/elasticsearch/fullTextSearch.js.map +1 -1
  149. package/operations/entry/elasticsearch/fullTextSearchFields.js +7 -17
  150. package/operations/entry/elasticsearch/fullTextSearchFields.js.map +1 -1
  151. package/operations/entry/elasticsearch/initialQuery.js +37 -80
  152. package/operations/entry/elasticsearch/initialQuery.js.map +1 -1
  153. package/operations/entry/elasticsearch/keyword.js +13 -27
  154. package/operations/entry/elasticsearch/keyword.js.map +1 -1
  155. package/operations/entry/elasticsearch/plugins/operator.js +9 -20
  156. package/operations/entry/elasticsearch/plugins/operator.js.map +1 -1
  157. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +6 -4
  158. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js.map +1 -1
  159. package/operations/entry/elasticsearch/sort.js +69 -92
  160. package/operations/entry/elasticsearch/sort.js.map +1 -1
  161. package/operations/entry/elasticsearch/transformValueForSearch.js +9 -14
  162. package/operations/entry/elasticsearch/transformValueForSearch.js.map +1 -1
  163. package/operations/entry/elasticsearch/types.js +0 -3
  164. package/operations/entry/index.js +1322 -1709
  165. package/operations/entry/index.js.map +1 -1
  166. package/operations/entry/keys.js +43 -63
  167. package/operations/entry/keys.js.map +1 -1
  168. package/operations/entry/recordType.js +4 -9
  169. package/operations/entry/recordType.js.map +1 -1
  170. package/operations/entry/transformations/convertEntryKeys.js +21 -26
  171. package/operations/entry/transformations/convertEntryKeys.js.map +1 -1
  172. package/operations/entry/transformations/index.js +85 -114
  173. package/operations/entry/transformations/index.js.map +1 -1
  174. package/operations/entry/transformations/modifyEntryValues.d.ts +1 -1
  175. package/operations/entry/transformations/modifyEntryValues.js +12 -17
  176. package/operations/entry/transformations/modifyEntryValues.js.map +1 -1
  177. package/operations/entry/transformations/transformEntryKeys.js +13 -16
  178. package/operations/entry/transformations/transformEntryKeys.js.map +1 -1
  179. package/operations/entry/transformations/transformEntryToIndex.js +17 -22
  180. package/operations/entry/transformations/transformEntryToIndex.js.map +1 -1
  181. package/operations/group/index.js +113 -134
  182. package/operations/group/index.js.map +1 -1
  183. package/operations/model/index.js +128 -156
  184. package/operations/model/index.js.map +1 -1
  185. package/package.json +23 -23
  186. package/tasks/createIndexTaskPlugin.js +35 -38
  187. package/tasks/createIndexTaskPlugin.js.map +1 -1
  188. package/types.js +7 -13
  189. package/types.js.map +1 -1
  190. package/values/NoValueContainer.js +8 -10
  191. package/values/NoValueContainer.js.map +1 -1
  192. package/definitions/types.js.map +0 -1
  193. package/exports/api/cms/opensearch.js.map +0 -1
  194. package/features/CmsEntryOpenSearchBodyModifier/index.js.map +0 -1
  195. package/features/CmsEntryOpenSearchFieldIndex/index.js.map +0 -1
  196. package/features/CmsEntryOpenSearchFilter/index.js.map +0 -1
  197. package/features/CmsEntryOpenSearchFullTextSearch/index.js.map +0 -1
  198. package/features/CmsEntryOpenSearchIndex/index.js.map +0 -1
  199. package/features/CmsEntryOpenSearchQueryModifier/index.js.map +0 -1
  200. package/features/CmsEntryOpenSearchSortModifier/index.js.map +0 -1
  201. package/features/CmsEntryOpenSearchValueSearch/index.js.map +0 -1
  202. package/features/CmsEntryOpenSearchValuesModifier/index.js.map +0 -1
  203. package/helpers/index.js.map +0 -1
  204. package/index.js.map +0 -1
  205. package/operations/entry/dataLoader/types.js.map +0 -1
  206. package/operations/entry/elasticsearch/filtering/index.js.map +0 -1
  207. package/operations/entry/elasticsearch/types.js.map +0 -1
@@ -1,158 +1,113 @@
1
1
  import { getFieldIdentifiers } from "../../../helpers/index.js";
2
2
  import { CmsEntryOpenSearchFieldIndex } from "../abstractions/CmsEntryOpenSearchFieldIndex.js";
3
- const processToIndex = params => {
4
- const {
5
- fields,
6
- value: sourceValue,
7
- rawValue: sourceRawValue,
8
- getFieldIndex,
9
- fieldRegistry,
10
- model
11
- } = params;
12
- return fields.reduce((values, field) => {
13
- const plugin = getFieldIndex(field.type);
14
- const identifiers = getFieldIdentifiers(sourceValue, sourceRawValue, field);
15
- if (!identifiers) {
16
- return values;
17
- }
18
- const {
19
- value,
20
- rawValue
21
- } = plugin.toIndex({
22
- model,
23
- field,
24
- value: sourceValue[identifiers.valueIdentifier || identifiers.rawValueIdentifier],
25
- rawValue: sourceRawValue[identifiers.rawValueIdentifier || identifiers.valueIdentifier],
26
- getFieldIndex,
27
- fieldRegistry
3
+ const processToIndex = (params)=>{
4
+ const { fields, value: sourceValue, rawValue: sourceRawValue, getFieldIndex, fieldRegistry, model } = params;
5
+ return fields.reduce((values, field)=>{
6
+ const plugin = getFieldIndex(field.type);
7
+ const identifiers = getFieldIdentifiers(sourceValue, sourceRawValue, field);
8
+ if (!identifiers) return values;
9
+ const { value, rawValue } = plugin.toIndex({
10
+ model,
11
+ field,
12
+ value: sourceValue[identifiers.valueIdentifier || identifiers.rawValueIdentifier],
13
+ rawValue: sourceRawValue[identifiers.rawValueIdentifier || identifiers.valueIdentifier],
14
+ getFieldIndex,
15
+ fieldRegistry
16
+ });
17
+ if (void 0 !== value) values.value[identifiers.valueIdentifier || identifiers.rawValueIdentifier] = value;
18
+ if (void 0 !== rawValue) values.rawValue[identifiers.rawValueIdentifier || identifiers.valueIdentifier] = rawValue;
19
+ return values;
20
+ }, {
21
+ value: {},
22
+ rawValue: {}
28
23
  });
29
- if (value !== undefined) {
30
- values.value[identifiers.valueIdentifier || identifiers.rawValueIdentifier] = value;
31
- }
32
- if (rawValue !== undefined) {
33
- values.rawValue[identifiers.rawValueIdentifier || identifiers.valueIdentifier] = rawValue;
34
- }
35
- return values;
36
- }, {
37
- value: {},
38
- rawValue: {}
39
- });
40
24
  };
41
- const processFromIndex = params => {
42
- const {
43
- fields,
44
- value: sourceValue,
45
- rawValue: sourceRawValue,
46
- getFieldIndex,
47
- fieldRegistry,
48
- model
49
- } = params;
50
- return fields.reduce((values, field) => {
51
- const plugin = getFieldIndex(field.type);
52
- const identifiers = getFieldIdentifiers(sourceValue, sourceRawValue, field);
53
- if (!identifiers) {
54
- return values;
55
- }
56
- const value = plugin.fromIndex({
57
- fieldRegistry,
58
- model,
59
- field,
60
- value: sourceValue[identifiers.valueIdentifier || identifiers.rawValueIdentifier],
61
- rawValue: sourceRawValue ? sourceRawValue[identifiers.rawValueIdentifier || identifiers.valueIdentifier] : null,
62
- getFieldIndex
63
- });
64
- if (value !== undefined) {
65
- values[identifiers.valueIdentifier || identifiers.rawValueIdentifier] = value;
66
- }
67
- return values;
68
- }, {});
25
+ const processFromIndex = (params)=>{
26
+ const { fields, value: sourceValue, rawValue: sourceRawValue, getFieldIndex, fieldRegistry, model } = params;
27
+ return fields.reduce((values, field)=>{
28
+ const plugin = getFieldIndex(field.type);
29
+ const identifiers = getFieldIdentifiers(sourceValue, sourceRawValue, field);
30
+ if (!identifiers) return values;
31
+ const value = plugin.fromIndex({
32
+ fieldRegistry,
33
+ model,
34
+ field,
35
+ value: sourceValue[identifiers.valueIdentifier || identifiers.rawValueIdentifier],
36
+ rawValue: sourceRawValue ? sourceRawValue[identifiers.rawValueIdentifier || identifiers.valueIdentifier] : null,
37
+ getFieldIndex
38
+ });
39
+ if (void 0 !== value) values[identifiers.valueIdentifier || identifiers.rawValueIdentifier] = value;
40
+ return values;
41
+ }, {});
69
42
  };
70
43
  class ObjectFieldIndexImpl {
71
- fieldType = "object";
72
- toIndex({
73
- fieldRegistry,
74
- model,
75
- field,
76
- value: initialValue,
77
- rawValue: initialRawValue,
78
- getFieldIndex
79
- }) {
80
- if (!initialValue) {
81
- return {
82
- value: null
83
- };
84
- }
85
- const fields = field.settings?.fields || [];
86
- if (field.list) {
87
- const result = {
88
- value: [],
89
- rawValue: []
90
- };
91
- for (const key in initialValue) {
92
- const {
93
- value,
94
- rawValue
95
- } = processToIndex({
96
- value: initialValue[key],
97
- rawValue: initialRawValue[key],
98
- getFieldIndex,
99
- model,
100
- fieldRegistry,
101
- fields
44
+ toIndex({ fieldRegistry, model, field, value: initialValue, rawValue: initialRawValue, getFieldIndex }) {
45
+ if (!initialValue) return {
46
+ value: null
47
+ };
48
+ const fields = field.settings?.fields || [];
49
+ if (field.list) {
50
+ const result = {
51
+ value: [],
52
+ rawValue: []
53
+ };
54
+ for(const key in initialValue){
55
+ const { value, rawValue } = processToIndex({
56
+ value: initialValue[key],
57
+ rawValue: initialRawValue[key],
58
+ getFieldIndex,
59
+ model,
60
+ fieldRegistry,
61
+ fields
62
+ });
63
+ result.value.push(value);
64
+ result.rawValue.push(rawValue);
65
+ }
66
+ return {
67
+ value: result.value.length > 0 ? result.value : void 0,
68
+ rawValue: result.rawValue.length > 0 ? result.rawValue : void 0
69
+ };
70
+ }
71
+ return processToIndex({
72
+ value: initialValue,
73
+ rawValue: initialRawValue,
74
+ getFieldIndex,
75
+ model,
76
+ fieldRegistry,
77
+ fields
102
78
  });
103
- result.value.push(value);
104
- result.rawValue.push(rawValue);
105
- }
106
- return {
107
- value: result.value.length > 0 ? result.value : undefined,
108
- rawValue: result.rawValue.length > 0 ? result.rawValue : undefined
109
- };
110
79
  }
111
- return processToIndex({
112
- value: initialValue,
113
- rawValue: initialRawValue,
114
- getFieldIndex,
115
- model,
116
- fieldRegistry,
117
- fields
118
- });
119
- }
120
- fromIndex({
121
- field,
122
- value,
123
- rawValue,
124
- model,
125
- getFieldIndex,
126
- fieldRegistry
127
- }) {
128
- if (!value) {
129
- return null;
80
+ fromIndex({ field, value, rawValue, model, getFieldIndex, fieldRegistry }) {
81
+ if (!value) return null;
82
+ const fields = field.settings?.fields || [];
83
+ if (field.list) {
84
+ const source = value || rawValue || [];
85
+ return source.map((_, index)=>processFromIndex({
86
+ value: value ? value[index] || {} : {},
87
+ rawValue: rawValue ? rawValue[index] || {} : {},
88
+ getFieldIndex,
89
+ model,
90
+ fieldRegistry,
91
+ fields
92
+ }));
93
+ }
94
+ return processFromIndex({
95
+ value,
96
+ rawValue,
97
+ getFieldIndex,
98
+ model,
99
+ fieldRegistry,
100
+ fields
101
+ });
130
102
  }
131
- const fields = field.settings?.fields || [];
132
- if (field.list) {
133
- const source = value || rawValue || [];
134
- return source.map((_, index) => processFromIndex({
135
- value: value ? value[index] || {} : {},
136
- rawValue: rawValue ? rawValue[index] || {} : {},
137
- getFieldIndex,
138
- model,
139
- fieldRegistry,
140
- fields
141
- }));
103
+ constructor(){
104
+ this.fieldType = "object";
142
105
  }
143
- return processFromIndex({
144
- value,
145
- rawValue,
146
- getFieldIndex,
147
- model,
148
- fieldRegistry,
149
- fields
150
- });
151
- }
152
106
  }
153
- export const ObjectFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({
154
- implementation: ObjectFieldIndexImpl,
155
- dependencies: []
107
+ const ObjectFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({
108
+ implementation: ObjectFieldIndexImpl,
109
+ dependencies: []
156
110
  });
111
+ export { ObjectFieldIndex };
157
112
 
158
113
  //# sourceMappingURL=ObjectFieldIndex.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getFieldIdentifiers","CmsEntryOpenSearchFieldIndex","processToIndex","params","fields","value","sourceValue","rawValue","sourceRawValue","getFieldIndex","fieldRegistry","model","reduce","values","field","plugin","type","identifiers","toIndex","valueIdentifier","rawValueIdentifier","undefined","processFromIndex","fromIndex","ObjectFieldIndexImpl","fieldType","initialValue","initialRawValue","settings","list","result","key","push","length","source","map","_","index","ObjectFieldIndex","createImplementation","implementation","dependencies"],"sources":["ObjectFieldIndex.ts"],"sourcesContent":["import type { CmsModel, CmsModelField } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { CmsModelFieldToGraphQLRegistry } from \"@webiny/api-headless-cms/exports/api/cms/graphql.js\";\nimport { getFieldIdentifiers } from \"~/helpers/index.js\";\nimport { CmsEntryOpenSearchFieldIndex } from \"../abstractions/CmsEntryOpenSearchFieldIndex.js\";\n\ninterface ProcessToIndexParams {\n fields: CmsModelField[];\n value: Record<string, any>;\n rawValue: Record<string, any>;\n getFieldIndex: (fieldType: string) => CmsEntryOpenSearchFieldIndex.Interface;\n fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;\n model: CmsModel;\n}\n\ninterface ReducerValue {\n value: Record<string, any>;\n rawValue: Record<string, any>;\n}\n\nconst processToIndex = (params: ProcessToIndexParams): ReducerValue => {\n const {\n fields,\n value: sourceValue,\n rawValue: sourceRawValue,\n getFieldIndex,\n fieldRegistry,\n model\n } = params;\n\n return fields.reduce<ReducerValue>(\n (values, field) => {\n const plugin = getFieldIndex(field.type);\n\n const identifiers = getFieldIdentifiers(sourceValue, sourceRawValue, field);\n if (!identifiers) {\n return values;\n }\n\n const { value, rawValue } = plugin.toIndex({\n model,\n field,\n value: sourceValue[identifiers.valueIdentifier || identifiers.rawValueIdentifier],\n rawValue:\n sourceRawValue[identifiers.rawValueIdentifier || identifiers.valueIdentifier],\n getFieldIndex,\n fieldRegistry\n });\n\n if (value !== undefined) {\n values.value[identifiers.valueIdentifier || identifiers.rawValueIdentifier] = value;\n }\n if (rawValue !== undefined) {\n values.rawValue[identifiers.rawValueIdentifier || identifiers.valueIdentifier] =\n rawValue;\n }\n\n return values;\n },\n { value: {}, rawValue: {} }\n );\n};\n\ninterface ProcessFromIndexParams {\n fields: CmsModelField[];\n value: Record<string, any>;\n rawValue?: Record<string, any> | null;\n getFieldIndex: (fieldType: string) => CmsEntryOpenSearchFieldIndex.Interface;\n fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;\n model: CmsModel;\n}\n\nconst processFromIndex = (params: ProcessFromIndexParams): Record<string, any> => {\n const {\n fields,\n value: sourceValue,\n rawValue: sourceRawValue,\n getFieldIndex,\n fieldRegistry,\n model\n } = params;\n\n return fields.reduce<Record<string, any>>((values, field) => {\n const plugin = getFieldIndex(field.type);\n\n const identifiers = getFieldIdentifiers(sourceValue, sourceRawValue, field);\n if (!identifiers) {\n return values;\n }\n\n const value = plugin.fromIndex({\n fieldRegistry,\n model,\n field,\n value: sourceValue[identifiers.valueIdentifier || identifiers.rawValueIdentifier],\n rawValue: sourceRawValue\n ? sourceRawValue[identifiers.rawValueIdentifier || identifiers.valueIdentifier]\n : null,\n getFieldIndex\n });\n\n if (value !== undefined) {\n values[identifiers.valueIdentifier || identifiers.rawValueIdentifier] = value;\n }\n\n return values;\n }, {});\n};\n\nclass ObjectFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {\n public readonly fieldType = \"object\";\n\n public toIndex({\n fieldRegistry,\n model,\n field,\n value: initialValue,\n rawValue: initialRawValue,\n getFieldIndex\n }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue {\n if (!initialValue) {\n return { value: null };\n }\n\n const fields = (field.settings?.fields || []) as CmsModelField[];\n\n if (field.list) {\n const result: { value: Record<string, any>[]; rawValue: Record<string, any>[] } = {\n value: [],\n rawValue: []\n };\n for (const key in initialValue) {\n const { value, rawValue } = processToIndex({\n value: initialValue[key],\n rawValue: initialRawValue[key],\n getFieldIndex,\n model,\n fieldRegistry,\n fields\n });\n\n result.value.push(value);\n result.rawValue.push(rawValue);\n }\n\n return {\n value: result.value.length > 0 ? result.value : undefined,\n rawValue: result.rawValue.length > 0 ? result.rawValue : undefined\n };\n }\n\n return processToIndex({\n value: initialValue,\n rawValue: initialRawValue,\n getFieldIndex,\n model,\n fieldRegistry,\n fields\n });\n }\n\n public fromIndex({\n field,\n value,\n rawValue,\n model,\n getFieldIndex,\n fieldRegistry\n }: CmsEntryOpenSearchFieldIndex.FromIndex): any {\n if (!value) {\n return null;\n }\n\n const fields = field.settings?.fields || [];\n\n if (field.list) {\n const source = value || rawValue || [];\n\n return source.map((_: any, index: number) =>\n processFromIndex({\n value: value ? value[index] || {} : {},\n rawValue: rawValue ? rawValue[index] || {} : {},\n getFieldIndex,\n model,\n fieldRegistry,\n fields\n })\n );\n }\n\n return processFromIndex({\n value,\n rawValue,\n getFieldIndex,\n model,\n fieldRegistry,\n fields\n });\n }\n}\n\nexport const ObjectFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({\n implementation: ObjectFieldIndexImpl,\n dependencies: []\n});\n"],"mappings":"AAEA,SAASA,mBAAmB;AAC5B,SAASC,4BAA4B;AAgBrC,MAAMC,cAAc,GAAIC,MAA4B,IAAmB;EACnE,MAAM;IACFC,MAAM;IACNC,KAAK,EAAEC,WAAW;IAClBC,QAAQ,EAAEC,cAAc;IACxBC,aAAa;IACbC,aAAa;IACbC;EACJ,CAAC,GAAGR,MAAM;EAEV,OAAOC,MAAM,CAACQ,MAAM,CAChB,CAACC,MAAM,EAAEC,KAAK,KAAK;IACf,MAAMC,MAAM,GAAGN,aAAa,CAACK,KAAK,CAACE,IAAI,CAAC;IAExC,MAAMC,WAAW,GAAGjB,mBAAmB,CAACM,WAAW,EAAEE,cAAc,EAAEM,KAAK,CAAC;IAC3E,IAAI,CAACG,WAAW,EAAE;MACd,OAAOJ,MAAM;IACjB;IAEA,MAAM;MAAER,KAAK;MAAEE;IAAS,CAAC,GAAGQ,MAAM,CAACG,OAAO,CAAC;MACvCP,KAAK;MACLG,KAAK;MACLT,KAAK,EAAEC,WAAW,CAACW,WAAW,CAACE,eAAe,IAAIF,WAAW,CAACG,kBAAkB,CAAC;MACjFb,QAAQ,EACJC,cAAc,CAACS,WAAW,CAACG,kBAAkB,IAAI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ex/fields/ObjectFieldIndex.js","sources":["../../../../src/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.ts"],"sourcesContent":["import type { CmsModel, CmsModelField } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { CmsModelFieldToGraphQLRegistry } from \"@webiny/api-headless-cms/exports/api/cms/graphql.js\";\nimport { getFieldIdentifiers } from \"~/helpers/index.js\";\nimport { CmsEntryOpenSearchFieldIndex } from \"../abstractions/CmsEntryOpenSearchFieldIndex.js\";\n\ninterface ProcessToIndexParams {\n fields: CmsModelField[];\n value: Record<string, any>;\n rawValue: Record<string, any>;\n getFieldIndex: (fieldType: string) => CmsEntryOpenSearchFieldIndex.Interface;\n fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;\n model: CmsModel;\n}\n\ninterface ReducerValue {\n value: Record<string, any>;\n rawValue: Record<string, any>;\n}\n\nconst processToIndex = (params: ProcessToIndexParams): ReducerValue => {\n const {\n fields,\n value: sourceValue,\n rawValue: sourceRawValue,\n getFieldIndex,\n fieldRegistry,\n model\n } = params;\n\n return fields.reduce<ReducerValue>(\n (values, field) => {\n const plugin = getFieldIndex(field.type);\n\n const identifiers = getFieldIdentifiers(sourceValue, sourceRawValue, field);\n if (!identifiers) {\n return values;\n }\n\n const { value, rawValue } = plugin.toIndex({\n model,\n field,\n value: sourceValue[identifiers.valueIdentifier || identifiers.rawValueIdentifier],\n rawValue:\n sourceRawValue[identifiers.rawValueIdentifier || identifiers.valueIdentifier],\n getFieldIndex,\n fieldRegistry\n });\n\n if (value !== undefined) {\n values.value[identifiers.valueIdentifier || identifiers.rawValueIdentifier] = value;\n }\n if (rawValue !== undefined) {\n values.rawValue[identifiers.rawValueIdentifier || identifiers.valueIdentifier] =\n rawValue;\n }\n\n return values;\n },\n { value: {}, rawValue: {} }\n );\n};\n\ninterface ProcessFromIndexParams {\n fields: CmsModelField[];\n value: Record<string, any>;\n rawValue?: Record<string, any> | null;\n getFieldIndex: (fieldType: string) => CmsEntryOpenSearchFieldIndex.Interface;\n fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;\n model: CmsModel;\n}\n\nconst processFromIndex = (params: ProcessFromIndexParams): Record<string, any> => {\n const {\n fields,\n value: sourceValue,\n rawValue: sourceRawValue,\n getFieldIndex,\n fieldRegistry,\n model\n } = params;\n\n return fields.reduce<Record<string, any>>((values, field) => {\n const plugin = getFieldIndex(field.type);\n\n const identifiers = getFieldIdentifiers(sourceValue, sourceRawValue, field);\n if (!identifiers) {\n return values;\n }\n\n const value = plugin.fromIndex({\n fieldRegistry,\n model,\n field,\n value: sourceValue[identifiers.valueIdentifier || identifiers.rawValueIdentifier],\n rawValue: sourceRawValue\n ? sourceRawValue[identifiers.rawValueIdentifier || identifiers.valueIdentifier]\n : null,\n getFieldIndex\n });\n\n if (value !== undefined) {\n values[identifiers.valueIdentifier || identifiers.rawValueIdentifier] = value;\n }\n\n return values;\n }, {});\n};\n\nclass ObjectFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {\n public readonly fieldType = \"object\";\n\n public toIndex({\n fieldRegistry,\n model,\n field,\n value: initialValue,\n rawValue: initialRawValue,\n getFieldIndex\n }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue {\n if (!initialValue) {\n return { value: null };\n }\n\n const fields = (field.settings?.fields || []) as CmsModelField[];\n\n if (field.list) {\n const result: { value: Record<string, any>[]; rawValue: Record<string, any>[] } = {\n value: [],\n rawValue: []\n };\n for (const key in initialValue) {\n const { value, rawValue } = processToIndex({\n value: initialValue[key],\n rawValue: initialRawValue[key],\n getFieldIndex,\n model,\n fieldRegistry,\n fields\n });\n\n result.value.push(value);\n result.rawValue.push(rawValue);\n }\n\n return {\n value: result.value.length > 0 ? result.value : undefined,\n rawValue: result.rawValue.length > 0 ? result.rawValue : undefined\n };\n }\n\n return processToIndex({\n value: initialValue,\n rawValue: initialRawValue,\n getFieldIndex,\n model,\n fieldRegistry,\n fields\n });\n }\n\n public fromIndex({\n field,\n value,\n rawValue,\n model,\n getFieldIndex,\n fieldRegistry\n }: CmsEntryOpenSearchFieldIndex.FromIndex): any {\n if (!value) {\n return null;\n }\n\n const fields = field.settings?.fields || [];\n\n if (field.list) {\n const source = value || rawValue || [];\n\n return source.map((_: any, index: number) =>\n processFromIndex({\n value: value ? value[index] || {} : {},\n rawValue: rawValue ? rawValue[index] || {} : {},\n getFieldIndex,\n model,\n fieldRegistry,\n fields\n })\n );\n }\n\n return processFromIndex({\n value,\n rawValue,\n getFieldIndex,\n model,\n fieldRegistry,\n fields\n });\n }\n}\n\nexport const ObjectFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({\n implementation: ObjectFieldIndexImpl,\n dependencies: []\n});\n"],"names":["processToIndex","params","fields","sourceValue","sourceRawValue","getFieldIndex","fieldRegistry","model","values","field","plugin","identifiers","getFieldIdentifiers","value","rawValue","undefined","processFromIndex","ObjectFieldIndexImpl","initialValue","initialRawValue","result","key","source","_","index","ObjectFieldIndex","CmsEntryOpenSearchFieldIndex"],"mappings":";;AAmBA,MAAMA,iBAAiB,CAACC;IACpB,MAAM,EACFC,MAAM,EACN,OAAOC,WAAW,EAClB,UAAUC,cAAc,EACxBC,aAAa,EACbC,aAAa,EACbC,KAAK,EACR,GAAGN;IAEJ,OAAOC,OAAO,MAAM,CAChB,CAACM,QAAQC;QACL,MAAMC,SAASL,cAAcI,MAAM,IAAI;QAEvC,MAAME,cAAcC,oBAAoBT,aAAaC,gBAAgBK;QACrE,IAAI,CAACE,aACD,OAAOH;QAGX,MAAM,EAAEK,KAAK,EAAEC,QAAQ,EAAE,GAAGJ,OAAO,OAAO,CAAC;YACvCH;YACAE;YACA,OAAON,WAAW,CAACQ,YAAY,eAAe,IAAIA,YAAY,kBAAkB,CAAC;YACjF,UACIP,cAAc,CAACO,YAAY,kBAAkB,IAAIA,YAAY,eAAe,CAAC;YACjFN;YACAC;QACJ;QAEA,IAAIO,AAAUE,WAAVF,OACAL,OAAO,KAAK,CAACG,Y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/CmsEntryOpenSearchFieldIndex.js";
2
2
  class RichTextFieldIndexImpl {
3
- fieldType = "rich-text";
4
- toIndex({
5
- value
6
- }) {
7
- return {
8
- rawValue: value
9
- };
10
- }
11
- fromIndex({
12
- rawValue
13
- }) {
14
- return rawValue;
15
- }
3
+ toIndex({ value }) {
4
+ return {
5
+ rawValue: value
6
+ };
7
+ }
8
+ fromIndex({ rawValue }) {
9
+ return rawValue;
10
+ }
11
+ constructor(){
12
+ this.fieldType = "rich-text";
13
+ }
16
14
  }
17
- export const RichTextFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({
18
- implementation: RichTextFieldIndexImpl,
19
- dependencies: []
15
+ const RichTextFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({
16
+ implementation: RichTextFieldIndexImpl,
17
+ dependencies: []
20
18
  });
19
+ export { RichTextFieldIndex };
21
20
 
22
21
  //# sourceMappingURL=RichTextFieldIndex.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["CmsEntryOpenSearchFieldIndex","RichTextFieldIndexImpl","fieldType","toIndex","value","rawValue","fromIndex","RichTextFieldIndex","createImplementation","implementation","dependencies"],"sources":["RichTextFieldIndex.ts"],"sourcesContent":["import { CmsEntryOpenSearchFieldIndex } from \"../abstractions/CmsEntryOpenSearchFieldIndex.js\";\n\nclass RichTextFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {\n public readonly fieldType = \"rich-text\";\n\n public toIndex({\n value\n }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue {\n return {\n rawValue: value\n };\n }\n\n public fromIndex({ rawValue }: CmsEntryOpenSearchFieldIndex.FromIndex): any {\n return rawValue;\n }\n}\n\nexport const RichTextFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({\n implementation: RichTextFieldIndexImpl,\n dependencies: []\n});\n"],"mappings":"AAAA,SAASA,4BAA4B;AAErC,MAAMC,sBAAsB,CAAmD;EAC3DC,SAAS,GAAG,WAAW;EAEhCC,OAAOA,CAAC;IACXC;EACkC,CAAC,EAAwC;IAC3E,OAAO;MACHC,QAAQ,EAAED;IACd,CAAC;EACL;EAEOE,SAASA,CAAC;IAAED;EAAiD,CAAC,EAAO;IACxE,OAAOA,QAAQ;EACnB;AACJ;AAEA,OAAO,MAAME,kBAAkB,GAAGP,4BAA4B,CAACQ,oBAAoB,CAAC;EAChFC,cAAc,EAAER,sBAAsB;EACtCS,YAAY,EAAE;AAClB,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.js","sources":["../../../../src/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.ts"],"sourcesContent":["import { CmsEntryOpenSearchFieldIndex } from \"../abstractions/CmsEntryOpenSearchFieldIndex.js\";\n\nclass RichTextFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {\n public readonly fieldType = \"rich-text\";\n\n public toIndex({\n value\n }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue {\n return {\n rawValue: value\n };\n }\n\n public fromIndex({ rawValue }: CmsEntryOpenSearchFieldIndex.FromIndex): any {\n return rawValue;\n }\n}\n\nexport const RichTextFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({\n implementation: RichTextFieldIndexImpl,\n dependencies: []\n});\n"],"names":["RichTextFieldIndexImpl","value","rawValue","RichTextFieldIndex","CmsEntryOpenSearchFieldIndex"],"mappings":";AAEA,MAAMA;IAGK,QAAQ,EACXC,KAAK,EAC8B,EAAwC;QAC3E,OAAO;YACH,UAAUA;QACd;IACJ;IAEO,UAAU,EAAEC,QAAQ,EAA0C,EAAO;QACxE,OAAOA;IACX;;aAZgB,SAAS,GAAG;;AAahC;AAEO,MAAMC,qBAAqBC,6BAA6B,oBAAoB,CAAC;IAChF,gBAAgBJ;IAChB,cAAc,EAAE;AACpB"}
@@ -1,5 +1,3 @@
1
1
  export { CmsEntryOpenSearchFieldIndexFeature } from "./feature.js";
2
2
  export { CmsEntryOpenSearchFieldIndex } from "./abstractions/CmsEntryOpenSearchFieldIndex.js";
3
3
  export { CmsEntryOpenSearchFieldIndexRegistry } from "./abstractions/CmsEntryOpenSearchFieldIndexRegistry.js";
4
-
5
- //# sourceMappingURL=index.js.map
@@ -1,38 +1,36 @@
1
- import WebinyError from "@webiny/error";
2
- import { CmsEntryOpenSearchFilterRegistry as Abstraction } from "./abstractions/CmsEntryOpenSearchFilterRegistry.js";
1
+ import error from "@webiny/error";
2
+ import { CmsEntryOpenSearchFilterRegistry } from "./abstractions/CmsEntryOpenSearchFilterRegistry.js";
3
3
  import { CmsEntryOpenSearchFilter } from "./abstractions/CmsEntryOpenSearchFilter.js";
4
4
  import { getBaseFieldType } from "@webiny/api-headless-cms/utils/getBaseFieldType.js";
5
5
  import { FILTER_DEFAULT } from "./constants.js";
6
6
  class CmsEntryOpenSearchFilterRegistryImpl {
7
- constructor(filters) {
8
- this.filters = filters;
9
- }
10
- get(type) {
11
- const fieldType = getBaseFieldType({
12
- type
13
- });
14
- const filter = this.filters.find(f => {
15
- return f.fieldType === fieldType;
16
- });
17
- if (filter) {
18
- return filter;
7
+ constructor(filters){
8
+ this.filters = filters;
19
9
  }
20
- const fallback = this.filters.find(f => {
21
- return f.fieldType === FILTER_DEFAULT;
22
- });
23
- if (fallback) {
24
- return fallback;
10
+ get(type) {
11
+ const fieldType = getBaseFieldType({
12
+ type
13
+ });
14
+ const filter = this.filters.find((f)=>f.fieldType === fieldType);
15
+ if (filter) return filter;
16
+ const fallback = this.filters.find((f)=>f.fieldType === FILTER_DEFAULT);
17
+ if (fallback) return fallback;
18
+ throw new error(`There is no filter for the given field type "${fieldType}".`, "FILTER_REGISTRY_ERROR", {
19
+ fieldType
20
+ });
25
21
  }
26
- throw new WebinyError(`There is no filter for the given field type "${fieldType}".`, "FILTER_REGISTRY_ERROR", {
27
- fieldType
28
- });
29
- }
30
22
  }
31
- export const CmsEntryOpenSearchFilterRegistry = Abstraction.createImplementation({
32
- implementation: CmsEntryOpenSearchFilterRegistryImpl,
33
- dependencies: [[CmsEntryOpenSearchFilter, {
34
- multiple: true
35
- }]]
23
+ const CmsEntryOpenSearchFilterRegistry_CmsEntryOpenSearchFilterRegistry = CmsEntryOpenSearchFilterRegistry.createImplementation({
24
+ implementation: CmsEntryOpenSearchFilterRegistryImpl,
25
+ dependencies: [
26
+ [
27
+ CmsEntryOpenSearchFilter,
28
+ {
29
+ multiple: true
30
+ }
31
+ ]
32
+ ]
36
33
  });
34
+ export { CmsEntryOpenSearchFilterRegistry_CmsEntryOpenSearchFilterRegistry as CmsEntryOpenSearchFilterRegistry };
37
35
 
38
36
  //# sourceMappingURL=CmsEntryOpenSearchFilterRegistry.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["WebinyError","CmsEntryOpenSearchFilterRegistry","Abstraction","CmsEntryOpenSearchFilter","getBaseFieldType","FILTER_DEFAULT","CmsEntryOpenSearchFilterRegistryImpl","constructor","filters","get","type","fieldType","filter","find","f","fallback","createImplementation","implementation","dependencies","multiple"],"sources":["CmsEntryOpenSearchFilterRegistry.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsEntryOpenSearchFilterRegistry as Abstraction } from \"./abstractions/CmsEntryOpenSearchFilterRegistry.js\";\nimport { CmsEntryOpenSearchFilter } from \"./abstractions/CmsEntryOpenSearchFilter.js\";\nimport { getBaseFieldType } from \"@webiny/api-headless-cms/utils/getBaseFieldType.js\";\nimport { FILTER_DEFAULT } from \"./constants.js\";\n\nclass CmsEntryOpenSearchFilterRegistryImpl implements Abstraction.Interface {\n public constructor(private readonly filters: CmsEntryOpenSearchFilter.Interface[]) {}\n\n public get(type: string): CmsEntryOpenSearchFilter.Interface {\n const fieldType = getBaseFieldType({ type });\n const filter = this.filters.find(f => {\n return f.fieldType === fieldType;\n });\n if (filter) {\n return filter;\n }\n const fallback = this.filters.find(f => {\n return f.fieldType === FILTER_DEFAULT;\n });\n if (fallback) {\n return fallback;\n }\n throw new WebinyError(\n `There is no filter for the given field type \"${fieldType}\".`,\n \"FILTER_REGISTRY_ERROR\",\n {\n fieldType\n }\n );\n }\n}\n\nexport const CmsEntryOpenSearchFilterRegistry = Abstraction.createImplementation({\n implementation: CmsEntryOpenSearchFilterRegistryImpl,\n dependencies: [[CmsEntryOpenSearchFilter, { multiple: true }]]\n});\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,gCAAgC,IAAIC,WAAW;AACxD,SAASC,wBAAwB;AACjC,SAASC,gBAAgB,QAAQ,oDAAoD;AACrF,SAASC,cAAc;AAEvB,MAAMC,oCAAoC,CAAkC;EACjEC,WAAWA,CAAkBC,OAA6C,EAAE;IAAA,KAA/CA,OAA6C,GAA7CA,OAA6C;EAAG;EAE7EC,GAAGA,CAACC,IAAY,EAAsC;IACzD,MAAMC,SAAS,GAAGP,gBAAgB,CAAC;MAAEM;IAAK,CAAC,CAAC;IAC5C,MAAME,MAAM,GAAG,IAAI,CAACJ,OAAO,CAACK,IAAI,CAACC,CAAC,IAAI;MAClC,OAAOA,CAAC,CAACH,SAAS,KAAKA,SAAS;IACpC,CAAC,CAAC;IACF,IAAIC,MAAM,EAAE;MACR,OAAOA,MAAM;IACjB;IACA,MAAMG,QAAQ,GAAG,IAAI,CAACP,OAAO,CAACK,IAAI,CAACC,CAAC,IAAI;MACpC,OAAOA,CAAC,CAACH,SAAS,KAAKN,cAAc;IACzC,CAAC,CAAC;IACF,IAAIU,QAAQ,EAAE;MACV,OAAOA,QAAQ;IACnB;IACA,MAAM,IAAIf,WAAW,CACjB,gDAAgDW,SAAS,IAAI,EAC7D,uBAAuB,EACvB;MACIA;IACJ,CACJ,CAAC;EACL;AACJ;AAEA,OAAO,MAAMV,gCAAgC,GAAGC,WAAW,CAACc,oBAAoB,CAAC;EAC7EC,cAAc,EAAEX,oCAAoC;EACpDY,YAAY,EAAE,CAAC,CAACf,wBAAwB,EAAE;IAAEgB,QAAQ,EAAE;EAAK,CAAC,CAAC;AACjE,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.js","sources":["../../../src/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsEntryOpenSearchFilterRegistry as Abstraction } from \"./abstractions/CmsEntryOpenSearchFilterRegistry.js\";\nimport { CmsEntryOpenSearchFilter } from \"./abstractions/CmsEntryOpenSearchFilter.js\";\nimport { getBaseFieldType } from \"@webiny/api-headless-cms/utils/getBaseFieldType.js\";\nimport { FILTER_DEFAULT } from \"./constants.js\";\n\nclass CmsEntryOpenSearchFilterRegistryImpl implements Abstraction.Interface {\n public constructor(private readonly filters: CmsEntryOpenSearchFilter.Interface[]) {}\n\n public get(type: string): CmsEntryOpenSearchFilter.Interface {\n const fieldType = getBaseFieldType({ type });\n const filter = this.filters.find(f => {\n return f.fieldType === fieldType;\n });\n if (filter) {\n return filter;\n }\n const fallback = this.filters.find(f => {\n return f.fieldType === FILTER_DEFAULT;\n });\n if (fallback) {\n return fallback;\n }\n throw new WebinyError(\n `There is no filter for the given field type \"${fieldType}\".`,\n \"FILTER_REGISTRY_ERROR\",\n {\n fieldType\n }\n );\n }\n}\n\nexport const CmsEntryOpenSearchFilterRegistry = Abstraction.createImplementation({\n implementation: CmsEntryOpenSearchFilterRegistryImpl,\n dependencies: [[CmsEntryOpenSearchFilter, { multiple: true }]]\n});\n"],"names":["CmsEntryOpenSearchFilterRegistryImpl","filters","type","fieldType","getBaseFieldType","filter","f","fallback","FILTER_DEFAULT","WebinyError","CmsEntryOpenSearchFilterRegistry","Abstraction","CmsEntryOpenSearchFilter"],"mappings":";;;;;AAMA,MAAMA;IACF,YAAoCC,OAA6C,CAAE;aAA/CA,OAAO,GAAPA;IAAgD;IAE7E,IAAIC,IAAY,EAAsC;QACzD,MAAMC,YAAYC,iBAAiB;YAAEF;QAAK;QAC1C,MAAMG,SAAS,IAAI,CAAC,OAAO,CAAC,IAAI,CAACC,CAAAA,IACtBA,EAAE,SAAS,KAAKH;QAE3B,IAAIE,QACA,OAAOA;QAEX,MAAME,WAAW,IAAI,CAAC,OAAO,CAAC,IAAI,CAACD,CAAAA,IACxBA,EAAE,SAAS,KAAKE;QAE3B,IAAID,UACA,OAAOA;QAEX,MAAM,IAAIE,MACN,CAAC,6CAA6C,EAAEN,UAAU,EAAE,CAAC,EAC7D,yBACA;YACIA;QACJ;IAER;AACJ;AAEO,MAAMO,oEAAmCC,iCAAAA,oBAAgC,CAAC;IAC7E,gBAAgBX;IAChB,cAAc;QAAC;YAACY;YAA0B;gBAAE,UAAU;YAAK;SAAE;KAAC;AAClE"}
@@ -1,4 +1,5 @@
1
1
  import { createAbstraction } from "@webiny/feature/api";
2
- export const CmsEntryOpenSearchFilter = createAbstraction("Cms/Entry/OpenSearch/Filter");
2
+ const CmsEntryOpenSearchFilter = createAbstraction("Cms/Entry/OpenSearch/Filter");
3
+ export { CmsEntryOpenSearchFilter };
3
4
 
4
5
  //# sourceMappingURL=CmsEntryOpenSearchFilter.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createAbstraction","CmsEntryOpenSearchFilter"],"sources":["CmsEntryOpenSearchFilter.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { ModelField, ModelFields } from \"~/operations/entry/elasticsearch/types.js\";\nimport type { OpenSearchBoolQueryConfig } from \"@webiny/api-opensearch/types.js\";\n\ninterface ApplyParams {\n key: string;\n value: any;\n query: OpenSearchBoolQueryConfig;\n operator: string;\n field: ModelField;\n}\n\nexport interface ApplyFilteringCb {\n (params: ApplyParams): void;\n}\n\nexport interface GetFilterCb {\n (type: string): CmsEntryOpenSearchFilter.Interface;\n}\n\nexport interface IExecParams {\n applyFiltering: ApplyFilteringCb;\n getFilter: GetFilterCb;\n key: string;\n value: any;\n operator: string;\n field: ModelField;\n fields: ModelFields;\n query: OpenSearchBoolQueryConfig;\n}\n\nexport interface ICmsEntryOpenSearchFilter {\n readonly fieldType: string;\n exec(params: IExecParams): void;\n}\n\nexport const CmsEntryOpenSearchFilter = createAbstraction<ICmsEntryOpenSearchFilter>(\n \"Cms/Entry/OpenSearch/Filter\"\n);\n\nexport namespace CmsEntryOpenSearchFilter {\n export type Interface = ICmsEntryOpenSearchFilter;\n export type ExecParams = IExecParams;\n export type ApplyFiltering = ApplyFilteringCb;\n export type GetFilter = GetFilterCb;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAoCvD,OAAO,MAAMC,wBAAwB,GAAGD,iBAAiB,CACrD,6BACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.js","sources":["../../../../src/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { ModelField, ModelFields } from \"~/operations/entry/elasticsearch/types.js\";\nimport type { OpenSearchBoolQueryConfig } from \"@webiny/api-opensearch/types.js\";\n\ninterface ApplyParams {\n key: string;\n value: any;\n query: OpenSearchBoolQueryConfig;\n operator: string;\n field: ModelField;\n}\n\nexport interface ApplyFilteringCb {\n (params: ApplyParams): void;\n}\n\nexport interface GetFilterCb {\n (type: string): CmsEntryOpenSearchFilter.Interface;\n}\n\nexport interface IExecParams {\n applyFiltering: ApplyFilteringCb;\n getFilter: GetFilterCb;\n key: string;\n value: any;\n operator: string;\n field: ModelField;\n fields: ModelFields;\n query: OpenSearchBoolQueryConfig;\n}\n\nexport interface ICmsEntryOpenSearchFilter {\n readonly fieldType: string;\n exec(params: IExecParams): void;\n}\n\nexport const CmsEntryOpenSearchFilter = createAbstraction<ICmsEntryOpenSearchFilter>(\n \"Cms/Entry/OpenSearch/Filter\"\n);\n\nexport namespace CmsEntryOpenSearchFilter {\n export type Interface = ICmsEntryOpenSearchFilter;\n export type ExecParams = IExecParams;\n export type ApplyFiltering = ApplyFilteringCb;\n export type GetFilter = GetFilterCb;\n}\n"],"names":["CmsEntryOpenSearchFilter","createAbstraction"],"mappings":";AAoCO,MAAMA,2BAA2BC,kBACpC"}
@@ -1,4 +1,5 @@
1
1
  import { createAbstraction } from "@webiny/feature/api";
2
- export const CmsEntryOpenSearchFilterRegistry = createAbstraction("Cms/Entry/OpenSearch/FilterRegistry");
2
+ const CmsEntryOpenSearchFilterRegistry = createAbstraction("Cms/Entry/OpenSearch/FilterRegistry");
3
+ export { CmsEntryOpenSearchFilterRegistry };
3
4
 
4
5
  //# sourceMappingURL=CmsEntryOpenSearchFilterRegistry.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createAbstraction","CmsEntryOpenSearchFilterRegistry"],"sources":["CmsEntryOpenSearchFilterRegistry.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { CmsEntryOpenSearchFilter } from \"./CmsEntryOpenSearchFilter.js\";\n\nexport interface ICmsEntryOpenSearchFilterRegistry {\n get(fieldType: string): CmsEntryOpenSearchFilter.Interface;\n}\n\nexport const CmsEntryOpenSearchFilterRegistry =\n createAbstraction<ICmsEntryOpenSearchFilterRegistry>(\"Cms/Entry/OpenSearch/FilterRegistry\");\n\nexport namespace CmsEntryOpenSearchFilterRegistry {\n export type Interface = ICmsEntryOpenSearchFilterRegistry;\n export type Filter = CmsEntryOpenSearchFilter.Interface;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAOvD,OAAO,MAAMC,gCAAgC,GACzCD,iBAAiB,CAAoC,qCAAqC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.js","sources":["../../../../src/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { CmsEntryOpenSearchFilter } from \"./CmsEntryOpenSearchFilter.js\";\n\nexport interface ICmsEntryOpenSearchFilterRegistry {\n get(fieldType: string): CmsEntryOpenSearchFilter.Interface;\n}\n\nexport const CmsEntryOpenSearchFilterRegistry =\n createAbstraction<ICmsEntryOpenSearchFilterRegistry>(\"Cms/Entry/OpenSearch/FilterRegistry\");\n\nexport namespace CmsEntryOpenSearchFilterRegistry {\n export type Interface = ICmsEntryOpenSearchFilterRegistry;\n export type Filter = CmsEntryOpenSearchFilter.Interface;\n}\n"],"names":["CmsEntryOpenSearchFilterRegistry","createAbstraction"],"mappings":";AAOO,MAAMA,mCACTC,kBAAqD"}
@@ -1,3 +1,4 @@
1
- export const FILTER_DEFAULT = "*";
1
+ const FILTER_DEFAULT = "*";
2
+ export { FILTER_DEFAULT };
2
3
 
3
4
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["FILTER_DEFAULT"],"sources":["constants.ts"],"sourcesContent":["export const FILTER_DEFAULT = \"*\" as const;\n"],"mappings":"AAAA,OAAO,MAAMA,cAAc,GAAG,GAAY","ignoreList":[]}
1
+ {"version":3,"file":"features/CmsEntryOpenSearchFilter/constants.js","sources":["../../../src/features/CmsEntryOpenSearchFilter/constants.ts"],"sourcesContent":["export const FILTER_DEFAULT = \"*\" as const;\n"],"names":["FILTER_DEFAULT"],"mappings":"AAAO,MAAMA,iBAAiB"}
@@ -3,14 +3,15 @@ import { DefaultFilter } from "./fields/DefaultFilter.js";
3
3
  import { RefFilter } from "./fields/RefFilter.js";
4
4
  import { ObjectFilter } from "./fields/ObjectFilter.js";
5
5
  import { CmsEntryOpenSearchFilterRegistry } from "./CmsEntryOpenSearchFilterRegistry.js";
6
- export const CmsEntryOpenSearchFilterFeature = createFeature({
7
- name: "Cms/Entry/OpenSearch/FilterFeature",
8
- register: container => {
9
- container.register(DefaultFilter);
10
- container.register(RefFilter);
11
- container.register(ObjectFilter);
12
- container.register(CmsEntryOpenSearchFilterRegistry);
13
- }
6
+ const CmsEntryOpenSearchFilterFeature = createFeature({
7
+ name: "Cms/Entry/OpenSearch/FilterFeature",
8
+ register: (container)=>{
9
+ container.register(DefaultFilter);
10
+ container.register(RefFilter);
11
+ container.register(ObjectFilter);
12
+ container.register(CmsEntryOpenSearchFilterRegistry);
13
+ }
14
14
  });
15
+ export { CmsEntryOpenSearchFilterFeature };
15
16
 
16
17
  //# sourceMappingURL=feature.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createFeature","DefaultFilter","RefFilter","ObjectFilter","CmsEntryOpenSearchFilterRegistry","CmsEntryOpenSearchFilterFeature","name","register","container"],"sources":["feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { DefaultFilter } from \"./fields/DefaultFilter.js\";\nimport { RefFilter } from \"./fields/RefFilter.js\";\nimport { ObjectFilter } from \"./fields/ObjectFilter.js\";\nimport { CmsEntryOpenSearchFilterRegistry } from \"./CmsEntryOpenSearchFilterRegistry.js\";\n\nexport const CmsEntryOpenSearchFilterFeature = createFeature({\n name: \"Cms/Entry/OpenSearch/FilterFeature\",\n register: container => {\n container.register(DefaultFilter);\n container.register(RefFilter);\n container.register(ObjectFilter);\n container.register(CmsEntryOpenSearchFilterRegistry);\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,aAAa;AACtB,SAASC,SAAS;AAClB,SAASC,YAAY;AACrB,SAASC,gCAAgC;AAEzC,OAAO,MAAMC,+BAA+B,GAAGL,aAAa,CAAC;EACzDM,IAAI,EAAE,oCAAoC;EAC1CC,QAAQ,EAAEC,SAAS,IAAI;IACnBA,SAAS,CAACD,QAAQ,CAACN,aAAa,CAAC;IACjCO,SAAS,CAACD,QAAQ,CAACL,SAAS,CAAC;IAC7BM,SAAS,CAACD,QAAQ,CAACJ,YAAY,CAAC;IAChCK,SAAS,CAACD,QAAQ,CAACH,gCAAgC,CAAC;EACxD;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/CmsEntryOpenSearchFilter/feature.js","sources":["../../../src/features/CmsEntryOpenSearchFilter/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { DefaultFilter } from \"./fields/DefaultFilter.js\";\nimport { RefFilter } from \"./fields/RefFilter.js\";\nimport { ObjectFilter } from \"./fields/ObjectFilter.js\";\nimport { CmsEntryOpenSearchFilterRegistry } from \"./CmsEntryOpenSearchFilterRegistry.js\";\n\nexport const CmsEntryOpenSearchFilterFeature = createFeature({\n name: \"Cms/Entry/OpenSearch/FilterFeature\",\n register: container => {\n container.register(DefaultFilter);\n container.register(RefFilter);\n container.register(ObjectFilter);\n container.register(CmsEntryOpenSearchFilterRegistry);\n }\n});\n"],"names":["CmsEntryOpenSearchFilterFeature","createFeature","container","DefaultFilter","RefFilter","ObjectFilter","CmsEntryOpenSearchFilterRegistry"],"mappings":";;;;;AAMO,MAAMA,kCAAkCC,cAAc;IACzD,MAAM;IACN,UAAUC,CAAAA;QACNA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;QACnBF,UAAU,QAAQ,CAACG;QACnBH,UAAU,QAAQ,CAACI;IACvB;AACJ"}
@@ -1,23 +1,26 @@
1
- import WebinyError from "@webiny/error";
1
+ import error from "@webiny/error";
2
2
  import { CmsEntryOpenSearchFilter } from "../abstractions/CmsEntryOpenSearchFilter.js";
3
3
  import { FILTER_DEFAULT } from "../constants.js";
4
4
  class DefaultFilterImpl {
5
- fieldType = FILTER_DEFAULT;
6
- exec(params) {
7
- const {
8
- applyFiltering,
9
- field
10
- } = params;
11
- if (!field.searchable) {
12
- const identifier = [...field.parents.map(p => p.fieldId), field.field.fieldId].join(".");
13
- throw new WebinyError(`Field "${identifier}" is not searchable.`);
5
+ exec(params) {
6
+ const { applyFiltering, field } = params;
7
+ if (!field.searchable) {
8
+ const identifier = [
9
+ ...field.parents.map((p)=>p.fieldId),
10
+ field.field.fieldId
11
+ ].join(".");
12
+ throw new error(`Field "${identifier}" is not searchable.`);
13
+ }
14
+ applyFiltering(params);
15
+ }
16
+ constructor(){
17
+ this.fieldType = FILTER_DEFAULT;
14
18
  }
15
- applyFiltering(params);
16
- }
17
19
  }
18
- export const DefaultFilter = CmsEntryOpenSearchFilter.createImplementation({
19
- implementation: DefaultFilterImpl,
20
- dependencies: []
20
+ const DefaultFilter = CmsEntryOpenSearchFilter.createImplementation({
21
+ implementation: DefaultFilterImpl,
22
+ dependencies: []
21
23
  });
24
+ export { DefaultFilter };
22
25
 
23
26
  //# sourceMappingURL=DefaultFilter.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["WebinyError","CmsEntryOpenSearchFilter","FILTER_DEFAULT","DefaultFilterImpl","fieldType","exec","params","applyFiltering","field","searchable","identifier","parents","map","p","fieldId","join","DefaultFilter","createImplementation","implementation","dependencies"],"sources":["DefaultFilter.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsEntryOpenSearchFilter } from \"../abstractions/CmsEntryOpenSearchFilter.js\";\nimport { FILTER_DEFAULT } from \"../constants.js\";\n\nclass DefaultFilterImpl implements CmsEntryOpenSearchFilter.Interface {\n public readonly fieldType = FILTER_DEFAULT;\n\n public exec(params: CmsEntryOpenSearchFilter.ExecParams): void {\n const { applyFiltering, field } = params;\n if (!field.searchable) {\n const identifier = [...field.parents.map(p => p.fieldId), field.field.fieldId].join(\n \".\"\n );\n throw new WebinyError(`Field \"${identifier}\" is not searchable.`);\n }\n applyFiltering(params);\n }\n}\n\nexport const DefaultFilter = CmsEntryOpenSearchFilter.createImplementation({\n implementation: DefaultFilterImpl,\n dependencies: []\n});\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,wBAAwB;AACjC,SAASC,cAAc;AAEvB,MAAMC,iBAAiB,CAA+C;EAClDC,SAAS,GAAGF,cAAc;EAEnCG,IAAIA,CAACC,MAA2C,EAAQ;IAC3D,MAAM;MAAEC,cAAc;MAAEC;IAAM,CAAC,GAAGF,MAAM;IACxC,IAAI,CAACE,KAAK,CAACC,UAAU,EAAE;MACnB,MAAMC,UAAU,GAAG,CAAC,GAAGF,KAAK,CAACG,OAAO,CAACC,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,OAAO,CAAC,EAAEN,KAAK,CAACA,KAAK,CAACM,OAAO,CAAC,CAACC,IAAI,CAC/E,GACJ,CAAC;MACD,MAAM,IAAIf,WAAW,CAAC,UAAUU,UAAU,sBAAsB,CAAC;IACrE;IACAH,cAAc,CAACD,MAAM,CAAC;EAC1B;AACJ;AAEA,OAAO,MAAMU,aAAa,GAAGf,wBAAwB,CAACgB,oBAAoB,CAAC;EACvEC,cAAc,EAAEf,iBAAiB;EACjCgB,YAAY,EAAE;AAClB,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/CmsEntryOpenSearchFilter/fields/DefaultFilter.js","sources":["../../../../src/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsEntryOpenSearchFilter } from \"../abstractions/CmsEntryOpenSearchFilter.js\";\nimport { FILTER_DEFAULT } from \"../constants.js\";\n\nclass DefaultFilterImpl implements CmsEntryOpenSearchFilter.Interface {\n public readonly fieldType = FILTER_DEFAULT;\n\n public exec(params: CmsEntryOpenSearchFilter.ExecParams): void {\n const { applyFiltering, field } = params;\n if (!field.searchable) {\n const identifier = [...field.parents.map(p => p.fieldId), field.field.fieldId].join(\n \".\"\n );\n throw new WebinyError(`Field \"${identifier}\" is not searchable.`);\n }\n applyFiltering(params);\n }\n}\n\nexport const DefaultFilter = CmsEntryOpenSearchFilter.createImplementation({\n implementation: DefaultFilterImpl,\n dependencies: []\n});\n"],"names":["DefaultFilterImpl","params","applyFiltering","field","identifier","p","WebinyError","FILTER_DEFAULT","DefaultFilter","CmsEntryOpenSearchFilter"],"mappings":";;;AAIA,MAAMA;IAGK,KAAKC,MAA2C,EAAQ;QAC3D,MAAM,EAAEC,cAAc,EAAEC,KAAK,EAAE,GAAGF;QAClC,IAAI,CAACE,MAAM,UAAU,EAAE;YACnB,MAAMC,aAAa;mBAAID,MAAM,OAAO,CAAC,GAAG,CAACE,CAAAA,IAAKA,EAAE,OAAO;gBAAGF,MAAM,KAAK,CAAC,OAAO;aAAC,CAAC,IAAI,CAC/E;YAEJ,MAAM,IAAIG,MAAY,CAAC,OAAO,EAAEF,WAAW,oBAAoB,CAAC;QACpE;QACAF,eAAeD;IACnB;;aAXgB,SAAS,GAAGM;;AAYhC;AAEO,MAAMC,gBAAgBC,yBAAyB,oBAAoB,CAAC;IACvE,gBAAgBT;IAChB,cAAc,EAAE;AACpB"}