@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,77 +1,60 @@
1
1
  import { CmsEntryOpenSearchFieldIndex } from "../abstractions/CmsEntryOpenSearchFieldIndex.js";
2
- const convertTimeToNumber = time => {
3
- if (!time) {
4
- return null;
5
- }
6
- const [hours, minutes, seconds = 0] = time.split(":").map(Number);
7
- return hours * 60 * 60 + minutes * 60 + seconds;
2
+ const convertTimeToNumber = (time)=>{
3
+ if (!time) return null;
4
+ const [hours, minutes, seconds = 0] = time.split(":").map(Number);
5
+ return 60 * hours * 60 + 60 * minutes + seconds;
8
6
  };
9
- const convertNumberToTime = value => {
10
- if (value === undefined || value === null) {
11
- return null;
12
- }
13
- const hours = Math.floor(value / 60 / 60);
14
- const minutes = Math.floor((value - hours * 60 * 60) / 60);
15
- const seconds = Math.floor(value - hours * 60 * 60 - minutes * 60);
16
- return [hours, minutes, seconds].map(v => String(v).padStart(2, "0")).join(":");
7
+ const convertNumberToTime = (value)=>{
8
+ if (null == value) return null;
9
+ const hours = Math.floor(value / 60 / 60);
10
+ const minutes = Math.floor((value - 60 * hours * 60) / 60);
11
+ const seconds = Math.floor(value - 60 * hours * 60 - 60 * minutes);
12
+ return [
13
+ hours,
14
+ minutes,
15
+ seconds
16
+ ].map((v)=>String(v).padStart(2, "0")).join(":");
17
17
  };
18
- const convertValueToIndex = (value, field) => {
19
- if (!value) {
20
- return null;
21
- } else if (field.settings?.type === "time") {
22
- return convertTimeToNumber(value);
23
- }
24
- return value;
25
- };
26
- const convertValueFromIndex = (value, field) => {
27
- const type = field.settings?.type;
28
- if (type === "time") {
29
- return convertNumberToTime(value);
30
- } else if (!value) {
31
- return null;
32
- } else if (type === "dateTimeWithTimezone") {
18
+ const convertValueToIndex = (value, field)=>{
19
+ if (!value) return null;
20
+ if (field.settings?.type === "time") return convertTimeToNumber(value);
33
21
  return value;
34
- } else if (type === "date") {
35
- const dateValue = new Date(value);
36
- return dateValue.toISOString().slice(0, 10);
37
- }
38
- return new Date(value).toISOString();
22
+ };
23
+ const convertValueFromIndex = (value, field)=>{
24
+ const type = field.settings?.type;
25
+ if ("time" === type) return convertNumberToTime(value);
26
+ if (!value) return null;
27
+ if ("dateTimeWithTimezone" === type) return value;
28
+ if ("date" === type) {
29
+ const dateValue = new Date(value);
30
+ return dateValue.toISOString().slice(0, 10);
31
+ }
32
+ return new Date(value).toISOString();
39
33
  };
40
34
  class DateTimeFieldIndexImpl {
41
- fieldType = "datetime";
42
- unmappedType() {
43
- return "date";
44
- }
45
- toIndex({
46
- field,
47
- value
48
- }) {
49
- if (Array.isArray(value) === true) {
50
- return {
51
- value: value.map(v => {
52
- return convertValueToIndex(v, field);
53
- })
54
- };
35
+ unmappedType() {
36
+ return "date";
37
+ }
38
+ toIndex({ field, value }) {
39
+ if (true === Array.isArray(value)) return {
40
+ value: value.map((v)=>convertValueToIndex(v, field))
41
+ };
42
+ return {
43
+ value: convertValueToIndex(value, field)
44
+ };
45
+ }
46
+ fromIndex({ field, value }) {
47
+ if (true === Array.isArray(value)) return value.map((v)=>convertValueFromIndex(v, field));
48
+ return convertValueFromIndex(value, field);
55
49
  }
56
- return {
57
- value: convertValueToIndex(value, field)
58
- };
59
- }
60
- fromIndex({
61
- field,
62
- value
63
- }) {
64
- if (Array.isArray(value) === true) {
65
- return value.map(v => {
66
- return convertValueFromIndex(v, field);
67
- });
50
+ constructor(){
51
+ this.fieldType = "datetime";
68
52
  }
69
- return convertValueFromIndex(value, field);
70
- }
71
53
  }
72
- export const DateTimeFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({
73
- implementation: DateTimeFieldIndexImpl,
74
- dependencies: []
54
+ const DateTimeFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({
55
+ implementation: DateTimeFieldIndexImpl,
56
+ dependencies: []
75
57
  });
58
+ export { DateTimeFieldIndex };
76
59
 
77
60
  //# sourceMappingURL=DateTimeFieldIndex.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["CmsEntryOpenSearchFieldIndex","convertTimeToNumber","time","hours","minutes","seconds","split","map","Number","convertNumberToTime","value","undefined","Math","floor","v","String","padStart","join","convertValueToIndex","field","settings","type","convertValueFromIndex","dateValue","Date","toISOString","slice","DateTimeFieldIndexImpl","fieldType","unmappedType","toIndex","Array","isArray","fromIndex","DateTimeFieldIndex","createImplementation","implementation","dependencies"],"sources":["DateTimeFieldIndex.ts"],"sourcesContent":["import type { CmsModelDateTimeField } from \"@webiny/api-headless-cms/types/index.js\";\nimport { CmsEntryOpenSearchFieldIndex } from \"../abstractions/CmsEntryOpenSearchFieldIndex.js\";\n\nconst convertTimeToNumber = (time?: string): number | null => {\n if (!time) {\n return null;\n }\n const [hours, minutes, seconds = 0] = time.split(\":\").map(Number);\n return hours * 60 * 60 + minutes * 60 + seconds;\n};\n\nconst convertNumberToTime = (value?: number): string | null => {\n if (value === undefined || value === null) {\n return null;\n }\n\n const hours = Math.floor(value / 60 / 60);\n const minutes = Math.floor((value - hours * 60 * 60) / 60);\n const seconds = Math.floor(value - hours * 60 * 60 - minutes * 60);\n\n return [hours, minutes, seconds].map(v => String(v).padStart(2, \"0\")).join(\":\");\n};\n\nconst convertValueToIndex = (value: string, field: CmsModelDateTimeField) => {\n if (!value) {\n return null;\n } else if (field.settings?.type === \"time\") {\n return convertTimeToNumber(value);\n }\n return value;\n};\n\nconst convertValueFromIndex = (\n value: string | number,\n field: CmsModelDateTimeField\n): string | null => {\n const type = field.settings?.type;\n if (type === \"time\") {\n return convertNumberToTime(value as number);\n } else if (!value) {\n return null;\n } else if (type === \"dateTimeWithTimezone\") {\n return value as string;\n } else if (type === \"date\") {\n const dateValue = new Date(value);\n return dateValue.toISOString().slice(0, 10);\n }\n return new Date(value).toISOString();\n};\n\nclass DateTimeFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {\n public readonly fieldType = \"datetime\";\n\n public unmappedType(): string {\n return \"date\";\n }\n\n public toIndex({\n field,\n value\n }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue {\n if (Array.isArray(value) === true) {\n return {\n value: value.map((v: string) => {\n return convertValueToIndex(v, field as CmsModelDateTimeField);\n })\n };\n }\n return {\n value: convertValueToIndex(value, field as CmsModelDateTimeField)\n };\n }\n\n public fromIndex({ field, value }: CmsEntryOpenSearchFieldIndex.FromIndex): any {\n if (Array.isArray(value) === true) {\n return value.map((v: string) => {\n return convertValueFromIndex(v, field as CmsModelDateTimeField);\n });\n }\n return convertValueFromIndex(value, field as CmsModelDateTimeField);\n }\n}\n\nexport const DateTimeFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({\n implementation: DateTimeFieldIndexImpl,\n dependencies: []\n});\n"],"mappings":"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","ignoreList":[]}
1
+ {"version":3,"file":"features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.js","sources":["../../../../src/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.ts"],"sourcesContent":["import type { CmsModelDateTimeField } from \"@webiny/api-headless-cms/types/index.js\";\nimport { CmsEntryOpenSearchFieldIndex } from \"../abstractions/CmsEntryOpenSearchFieldIndex.js\";\n\nconst convertTimeToNumber = (time?: string): number | null => {\n if (!time) {\n return null;\n }\n const [hours, minutes, seconds = 0] = time.split(\":\").map(Number);\n return hours * 60 * 60 + minutes * 60 + seconds;\n};\n\nconst convertNumberToTime = (value?: number): string | null => {\n if (value === undefined || value === null) {\n return null;\n }\n\n const hours = Math.floor(value / 60 / 60);\n const minutes = Math.floor((value - hours * 60 * 60) / 60);\n const seconds = Math.floor(value - hours * 60 * 60 - minutes * 60);\n\n return [hours, minutes, seconds].map(v => String(v).padStart(2, \"0\")).join(\":\");\n};\n\nconst convertValueToIndex = (value: string, field: CmsModelDateTimeField) => {\n if (!value) {\n return null;\n } else if (field.settings?.type === \"time\") {\n return convertTimeToNumber(value);\n }\n return value;\n};\n\nconst convertValueFromIndex = (\n value: string | number,\n field: CmsModelDateTimeField\n): string | null => {\n const type = field.settings?.type;\n if (type === \"time\") {\n return convertNumberToTime(value as number);\n } else if (!value) {\n return null;\n } else if (type === \"dateTimeWithTimezone\") {\n return value as string;\n } else if (type === \"date\") {\n const dateValue = new Date(value);\n return dateValue.toISOString().slice(0, 10);\n }\n return new Date(value).toISOString();\n};\n\nclass DateTimeFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {\n public readonly fieldType = \"datetime\";\n\n public unmappedType(): string {\n return \"date\";\n }\n\n public toIndex({\n field,\n value\n }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue {\n if (Array.isArray(value) === true) {\n return {\n value: value.map((v: string) => {\n return convertValueToIndex(v, field as CmsModelDateTimeField);\n })\n };\n }\n return {\n value: convertValueToIndex(value, field as CmsModelDateTimeField)\n };\n }\n\n public fromIndex({ field, value }: CmsEntryOpenSearchFieldIndex.FromIndex): any {\n if (Array.isArray(value) === true) {\n return value.map((v: string) => {\n return convertValueFromIndex(v, field as CmsModelDateTimeField);\n });\n }\n return convertValueFromIndex(value, field as CmsModelDateTimeField);\n }\n}\n\nexport const DateTimeFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({\n implementation: DateTimeFieldIndexImpl,\n dependencies: []\n});\n"],"names":["convertTimeToNumber","time","hours","minutes","seconds","Number","convertNumberToTime","value","Math","v","String","convertValueToIndex","field","convertValueFromIndex","type","dateValue","Date","DateTimeFieldIndexImpl","Array","DateTimeFieldIndex","CmsEntryOpenSearchFieldIndex"],"mappings":";AAGA,MAAMA,sBAAsB,CAACC;IACzB,IAAI,CAACA,MACD,OAAO;IAEX,MAAM,CAACC,OAAOC,SAASC,UAAU,CAAC,CAAC,GAAGH,KAAK,KAAK,CAAC,KAAK,GAAG,CAACI;IAC1D,OAAOH,AAAQ,KAARA,QAAa,KAAKC,AAAU,KAAVA,UAAeC;AAC5C;AAEA,MAAME,sBAAsB,CAACC;IACzB,IAAIA,QAAAA,OACA,OAAO;IAGX,MAAML,QAAQM,KAAK,KAAK,CAACD,QAAQ,KAAK;IACtC,MAAMJ,UAAUK,KAAK,KAAK,CAAED,AAAAA,CAAAA,QAAQL,AAAQ,KAARA,QAAa,EAAC,IAAK;IACvD,MAAME,UAAUI,KAAK,KAAK,CAACD,QAAQL,AAAQ,KAARA,QAAa,KAAKC,AAAU,KAAVA;IAErD,OAAO;QAACD;QAAOC;QAASC;KAAQ,CAAC,GAAG,CAACK,CAAAA,IAAKC,OAAOD,GAAG,QAAQ,CAAC,GAAG,MAAM,IAAI,CAAC;AAC/E;AAEA,MAAME,sBAAsB,CAACJ,OAAeK;IACxC,IAAI,CAACL,OACD,OAAO;IACJ,IAAIK,MAAM,QAAQ,EAAE,SAAS,QAChC,OAAOZ,oBAAoBO;IAE/B,OAAOA;AACX;AAEA,MAAMM,wBAAwB,CAC1BN,OACAK;IAEA,MAAME,OAAOF,MAAM,QAAQ,EAAE;IAC7B,IAAIE,AAAS,WAATA,MACA,OAAOR,oBAAoBC;IACxB,IAAI,CAACA,OACR,OAAO;IACJ,IAAIO,AAAS,2BAATA,MACP,OAAOP;IACJ,IAAIO,AAAS,WAATA,MAAiB;QACxB,MAAMC,YAAY,IAAIC,KAAKT;QAC3B,OAAOQ,UAAU,WAAW,GAAG,KAAK,CAAC,GAAG;IAC5C;IACA,OAAO,IAAIC,KAAKT,OAAO,WAAW;AACtC;AAEA,MAAMU;IAGK,eAAuB;QAC1B,OAAO;IACX;IAEO,QAAQ,EACXL,KAAK,EACLL,KAAK,EAC8B,EAAwC;QAC3E,IAAIW,AAAyB,SAAzBA,MAAM,OAAO,CAACX,QACd,OAAO;YACH,OAAOA,MAAM,GAAG,CAAC,CAACE,IACPE,oBAAoBF,GAAGG;QAEtC;QAEJ,OAAO;YACH,OAAOD,oBAAoBJ,OAAOK;QACtC;IACJ;IAEO,UAAU,EAAEA,KAAK,EAAEL,KAAK,EAA0C,EAAO;QAC5E,IAAIW,AAAyB,SAAzBA,MAAM,OAAO,CAACX,QACd,OAAOA,MAAM,GAAG,CAAC,CAACE,IACPI,sBAAsBJ,GAAGG;QAGxC,OAAOC,sBAAsBN,OAAOK;IACxC;;aA7BgB,SAAS,GAAG;;AA8BhC;AAEO,MAAMO,qBAAqBC,6BAA6B,oBAAoB,CAAC;IAChF,gBAAgBH;IAChB,cAAc,EAAE;AACpB"}
@@ -1,39 +1,29 @@
1
1
  import { CmsEntryOpenSearchFieldIndex } from "../abstractions/CmsEntryOpenSearchFieldIndex.js";
2
2
  import { FIELD_INDEXING_DEFAULT } from "../constants.js";
3
3
  class DefaultFieldIndexImpl {
4
- fieldType = FIELD_INDEXING_DEFAULT;
5
- toIndex({
6
- field,
7
- fieldRegistry,
8
- value
9
- }) {
10
- const fieldType = fieldRegistry.get(field.type);
11
- if (fieldType?.isSearchable === true) {
12
- return {
13
- value
14
- };
4
+ toIndex({ field, fieldRegistry, value }) {
5
+ const fieldType = fieldRegistry.get(field.type);
6
+ if (fieldType?.isSearchable === true) return {
7
+ value
8
+ };
9
+ return {
10
+ rawValue: value
11
+ };
15
12
  }
16
- return {
17
- rawValue: value
18
- };
19
- }
20
- fromIndex({
21
- field,
22
- fieldRegistry,
23
- value,
24
- rawValue
25
- }) {
26
- const fieldType = fieldRegistry.get(field.type);
27
- const isSearchable = fieldType?.isSearchable ?? false;
28
- if (isSearchable) {
29
- return value === undefined ? rawValue : value;
13
+ fromIndex({ field, fieldRegistry, value, rawValue }) {
14
+ const fieldType = fieldRegistry.get(field.type);
15
+ const isSearchable = fieldType?.isSearchable ?? false;
16
+ if (isSearchable) return void 0 === value ? rawValue : value;
17
+ return void 0 === rawValue ? value : rawValue;
18
+ }
19
+ constructor(){
20
+ this.fieldType = FIELD_INDEXING_DEFAULT;
30
21
  }
31
- return rawValue === undefined ? value : rawValue;
32
- }
33
22
  }
34
- export const DefaultFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({
35
- implementation: DefaultFieldIndexImpl,
36
- dependencies: []
23
+ const DefaultFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({
24
+ implementation: DefaultFieldIndexImpl,
25
+ dependencies: []
37
26
  });
27
+ export { DefaultFieldIndex };
38
28
 
39
29
  //# sourceMappingURL=DefaultFieldIndex.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["CmsEntryOpenSearchFieldIndex","FIELD_INDEXING_DEFAULT","DefaultFieldIndexImpl","fieldType","toIndex","field","fieldRegistry","value","get","type","isSearchable","rawValue","fromIndex","undefined","DefaultFieldIndex","createImplementation","implementation","dependencies"],"sources":["DefaultFieldIndex.ts"],"sourcesContent":["import { CmsEntryOpenSearchFieldIndex } from \"../abstractions/CmsEntryOpenSearchFieldIndex.js\";\nimport { FIELD_INDEXING_DEFAULT } from \"../constants.js\";\n\nclass DefaultFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {\n public readonly fieldType = FIELD_INDEXING_DEFAULT;\n\n public toIndex({\n field,\n fieldRegistry,\n value\n }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue {\n const fieldType = fieldRegistry.get(field.type);\n\n if (fieldType?.isSearchable === true) {\n return { value };\n }\n\n return { rawValue: value };\n }\n\n public fromIndex({\n field,\n fieldRegistry,\n value,\n rawValue\n }: CmsEntryOpenSearchFieldIndex.FromIndex): any {\n const fieldType = fieldRegistry.get(field.type);\n const isSearchable = fieldType?.isSearchable ?? false;\n\n if (isSearchable) {\n return value === undefined ? rawValue : value;\n }\n return rawValue === undefined ? value : rawValue;\n }\n}\n\nexport const DefaultFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({\n implementation: DefaultFieldIndexImpl,\n dependencies: []\n});\n"],"mappings":"AAAA,SAASA,4BAA4B;AACrC,SAASC,sBAAsB;AAE/B,MAAMC,qBAAqB,CAAmD;EAC1DC,SAAS,GAAGF,sBAAsB;EAE3CG,OAAOA,CAAC;IACXC,KAAK;IACLC,aAAa;IACbC;EACkC,CAAC,EAAwC;IAC3E,MAAMJ,SAAS,GAAGG,aAAa,CAACE,GAAG,CAACH,KAAK,CAACI,IAAI,CAAC;IAE/C,IAAIN,SAAS,EAAEO,YAAY,KAAK,IAAI,EAAE;MAClC,OAAO;QAAEH;MAAM,CAAC;IACpB;IAEA,OAAO;MAAEI,QAAQ,EAAEJ;IAAM,CAAC;EAC9B;EAEOK,SAASA,CAAC;IACbP,KAAK;IACLC,aAAa;IACbC,KAAK;IACLI;EACoC,CAAC,EAAO;IAC5C,MAAMR,SAAS,GAAGG,aAAa,CAACE,GAAG,CAACH,KAAK,CAACI,IAAI,CAAC;IAC/C,MAAMC,YAAY,GAAGP,SAAS,EAAEO,YAAY,IAAI,KAAK;IAErD,IAAIA,YAAY,EAAE;MACd,OAAOH,KAAK,KAAKM,SAAS,GAAGF,QAAQ,GAAGJ,KAAK;IACjD;IACA,OAAOI,QAAQ,KAAKE,SAAS,GAAGN,KAAK,GAAGI,QAAQ;EACpD;AACJ;AAEA,OAAO,MAAMG,iBAAiB,GAAGd,4BAA4B,CAACe,oBAAoB,CAAC;EAC/EC,cAAc,EAAEd,qBAAqB;EACrCe,YAAY,EAAE;AAClB,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js","sources":["../../../../src/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.ts"],"sourcesContent":["import { CmsEntryOpenSearchFieldIndex } from \"../abstractions/CmsEntryOpenSearchFieldIndex.js\";\nimport { FIELD_INDEXING_DEFAULT } from \"../constants.js\";\n\nclass DefaultFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {\n public readonly fieldType = FIELD_INDEXING_DEFAULT;\n\n public toIndex({\n field,\n fieldRegistry,\n value\n }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue {\n const fieldType = fieldRegistry.get(field.type);\n\n if (fieldType?.isSearchable === true) {\n return { value };\n }\n\n return { rawValue: value };\n }\n\n public fromIndex({\n field,\n fieldRegistry,\n value,\n rawValue\n }: CmsEntryOpenSearchFieldIndex.FromIndex): any {\n const fieldType = fieldRegistry.get(field.type);\n const isSearchable = fieldType?.isSearchable ?? false;\n\n if (isSearchable) {\n return value === undefined ? rawValue : value;\n }\n return rawValue === undefined ? value : rawValue;\n }\n}\n\nexport const DefaultFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({\n implementation: DefaultFieldIndexImpl,\n dependencies: []\n});\n"],"names":["DefaultFieldIndexImpl","field","fieldRegistry","value","fieldType","rawValue","isSearchable","undefined","FIELD_INDEXING_DEFAULT","DefaultFieldIndex","CmsEntryOpenSearchFieldIndex"],"mappings":";;AAGA,MAAMA;IAGK,QAAQ,EACXC,KAAK,EACLC,aAAa,EACbC,KAAK,EAC8B,EAAwC;QAC3E,MAAMC,YAAYF,cAAc,GAAG,CAACD,MAAM,IAAI;QAE9C,IAAIG,WAAW,iBAAiB,MAC5B,OAAO;YAAED;QAAM;QAGnB,OAAO;YAAE,UAAUA;QAAM;IAC7B;IAEO,UAAU,EACbF,KAAK,EACLC,aAAa,EACbC,KAAK,EACLE,QAAQ,EAC6B,EAAO;QAC5C,MAAMD,YAAYF,cAAc,GAAG,CAACD,MAAM,IAAI;QAC9C,MAAMK,eAAeF,WAAW,gBAAgB;QAEhD,IAAIE,cACA,OAAOH,AAAUI,WAAVJ,QAAsBE,WAAWF;QAE5C,OAAOE,AAAaE,WAAbF,WAAyBF,QAAQE;IAC5C;;aA7BgB,SAAS,GAAGG;;AA8BhC;AAEO,MAAMC,oBAAoBC,6BAA6B,oBAAoB,CAAC;IAC/E,gBAAgBV;IAChB,cAAc,EAAE;AACpB"}
@@ -1,22 +1,21 @@
1
1
  import { CmsEntryOpenSearchFieldIndex } from "../abstractions/CmsEntryOpenSearchFieldIndex.js";
2
2
  class JsonFieldIndexImpl {
3
- fieldType = "json";
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 = "json";
13
+ }
16
14
  }
17
- export const JsonFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({
18
- implementation: JsonFieldIndexImpl,
19
- dependencies: []
15
+ const JsonFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({
16
+ implementation: JsonFieldIndexImpl,
17
+ dependencies: []
20
18
  });
19
+ export { JsonFieldIndex };
21
20
 
22
21
  //# sourceMappingURL=JsonFieldIndex.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["CmsEntryOpenSearchFieldIndex","JsonFieldIndexImpl","fieldType","toIndex","value","rawValue","fromIndex","JsonFieldIndex","createImplementation","implementation","dependencies"],"sources":["JsonFieldIndex.ts"],"sourcesContent":["import { CmsEntryOpenSearchFieldIndex } from \"../abstractions/CmsEntryOpenSearchFieldIndex.js\";\n\nclass JsonFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {\n public readonly fieldType = \"json\";\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 JsonFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({\n implementation: JsonFieldIndexImpl,\n dependencies: []\n});\n"],"mappings":"AAAA,SAASA,4BAA4B;AAErC,MAAMC,kBAAkB,CAAmD;EACvDC,SAAS,GAAG,MAAM;EAE3BC,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,cAAc,GAAGP,4BAA4B,CAACQ,oBAAoB,CAAC;EAC5EC,cAAc,EAAER,kBAAkB;EAClCS,YAAY,EAAE;AAClB,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.js","sources":["../../../../src/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.ts"],"sourcesContent":["import { CmsEntryOpenSearchFieldIndex } from \"../abstractions/CmsEntryOpenSearchFieldIndex.js\";\n\nclass JsonFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {\n public readonly fieldType = \"json\";\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 JsonFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({\n implementation: JsonFieldIndexImpl,\n dependencies: []\n});\n"],"names":["JsonFieldIndexImpl","value","rawValue","JsonFieldIndex","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,iBAAiBC,6BAA6B,oBAAoB,CAAC;IAC5E,gBAAgBJ;IAChB,cAAc,EAAE;AACpB"}
@@ -1,25 +1,22 @@
1
1
  import { CmsEntryOpenSearchFieldIndex } from "../abstractions/CmsEntryOpenSearchFieldIndex.js";
2
2
  class LongTextFieldIndexImpl {
3
- fieldType = "long-text";
4
- toIndex({
5
- rawValue
6
- }) {
7
- return {
8
- value: Array.isArray(rawValue) ? rawValue : rawValue || ""
9
- };
10
- }
11
- fromIndex({
12
- value
13
- }) {
14
- if (Array.isArray(value)) {
15
- return value;
3
+ toIndex({ rawValue }) {
4
+ return {
5
+ value: Array.isArray(rawValue) ? rawValue : rawValue || ""
6
+ };
7
+ }
8
+ fromIndex({ value }) {
9
+ if (Array.isArray(value)) return value;
10
+ return value || "";
11
+ }
12
+ constructor(){
13
+ this.fieldType = "long-text";
16
14
  }
17
- return value || "";
18
- }
19
15
  }
20
- export const LongTextFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({
21
- implementation: LongTextFieldIndexImpl,
22
- dependencies: []
16
+ const LongTextFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({
17
+ implementation: LongTextFieldIndexImpl,
18
+ dependencies: []
23
19
  });
20
+ export { LongTextFieldIndex };
24
21
 
25
22
  //# sourceMappingURL=LongTextFieldIndex.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["CmsEntryOpenSearchFieldIndex","LongTextFieldIndexImpl","fieldType","toIndex","rawValue","value","Array","isArray","fromIndex","LongTextFieldIndex","createImplementation","implementation","dependencies"],"sources":["LongTextFieldIndex.ts"],"sourcesContent":["import { CmsEntryOpenSearchFieldIndex } from \"../abstractions/CmsEntryOpenSearchFieldIndex.js\";\n\nclass LongTextFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {\n public readonly fieldType = \"long-text\";\n\n public toIndex({\n rawValue\n }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue {\n return {\n value: Array.isArray(rawValue) ? rawValue : rawValue || \"\"\n };\n }\n\n public fromIndex({ value }: CmsEntryOpenSearchFieldIndex.FromIndex): any {\n if (Array.isArray(value)) {\n return value;\n }\n return value || \"\";\n }\n}\n\nexport const LongTextFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({\n implementation: LongTextFieldIndexImpl,\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,KAAK,EAAEC,KAAK,CAACC,OAAO,CAACH,QAAQ,CAAC,GAAGA,QAAQ,GAAGA,QAAQ,IAAI;IAC5D,CAAC;EACL;EAEOI,SAASA,CAAC;IAAEH;EAA8C,CAAC,EAAO;IACrE,IAAIC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,EAAE;MACtB,OAAOA,KAAK;IAChB;IACA,OAAOA,KAAK,IAAI,EAAE;EACtB;AACJ;AAEA,OAAO,MAAMI,kBAAkB,GAAGT,4BAA4B,CAACU,oBAAoB,CAAC;EAChFC,cAAc,EAAEV,sBAAsB;EACtCW,YAAY,EAAE;AAClB,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.js","sources":["../../../../src/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.ts"],"sourcesContent":["import { CmsEntryOpenSearchFieldIndex } from \"../abstractions/CmsEntryOpenSearchFieldIndex.js\";\n\nclass LongTextFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {\n public readonly fieldType = \"long-text\";\n\n public toIndex({\n rawValue\n }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue {\n return {\n value: Array.isArray(rawValue) ? rawValue : rawValue || \"\"\n };\n }\n\n public fromIndex({ value }: CmsEntryOpenSearchFieldIndex.FromIndex): any {\n if (Array.isArray(value)) {\n return value;\n }\n return value || \"\";\n }\n}\n\nexport const LongTextFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({\n implementation: LongTextFieldIndexImpl,\n dependencies: []\n});\n"],"names":["LongTextFieldIndexImpl","rawValue","Array","value","LongTextFieldIndex","CmsEntryOpenSearchFieldIndex"],"mappings":";AAEA,MAAMA;IAGK,QAAQ,EACXC,QAAQ,EAC2B,EAAwC;QAC3E,OAAO;YACH,OAAOC,MAAM,OAAO,CAACD,YAAYA,WAAWA,YAAY;QAC5D;IACJ;IAEO,UAAU,EAAEE,KAAK,EAA0C,EAAO;QACrE,IAAID,MAAM,OAAO,CAACC,QACd,OAAOA;QAEX,OAAOA,SAAS;IACpB;;aAfgB,SAAS,GAAG;;AAgBhC;AAEO,MAAMC,qBAAqBC,6BAA6B,oBAAoB,CAAC;IAChF,gBAAgBL;IAChB,cAAc,EAAE;AACpB"}
@@ -1,37 +1,32 @@
1
1
  import { CmsEntryOpenSearchFieldIndex } from "../abstractions/CmsEntryOpenSearchFieldIndex.js";
2
- const convertToString = value => {
3
- if (Array.isArray(value) === false) {
4
- return value;
5
- }
6
- return value.map(String);
2
+ const convertToString = (value)=>{
3
+ if (false === Array.isArray(value)) return value;
4
+ return value.map(String);
7
5
  };
8
- const convertToFloat = value => {
9
- if (Array.isArray(value) === false) {
10
- return typeof value === "string" ? parseFloat(value) : value;
11
- }
12
- return value.map(v => parseFloat(v));
6
+ const convertToFloat = (value)=>{
7
+ if (false === Array.isArray(value)) return "string" == typeof value ? parseFloat(value) : value;
8
+ return value.map((v)=>parseFloat(v));
13
9
  };
14
10
  class NumberFieldIndexImpl {
15
- fieldType = "number";
16
- unmappedType() {
17
- return "float";
18
- }
19
- toIndex({
20
- value
21
- }) {
22
- return {
23
- value: convertToString(value)
24
- };
25
- }
26
- fromIndex({
27
- value
28
- }) {
29
- return convertToFloat(value);
30
- }
11
+ unmappedType() {
12
+ return "float";
13
+ }
14
+ toIndex({ value }) {
15
+ return {
16
+ value: convertToString(value)
17
+ };
18
+ }
19
+ fromIndex({ value }) {
20
+ return convertToFloat(value);
21
+ }
22
+ constructor(){
23
+ this.fieldType = "number";
24
+ }
31
25
  }
32
- export const NumberFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({
33
- implementation: NumberFieldIndexImpl,
34
- dependencies: []
26
+ const NumberFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({
27
+ implementation: NumberFieldIndexImpl,
28
+ dependencies: []
35
29
  });
30
+ export { NumberFieldIndex };
36
31
 
37
32
  //# sourceMappingURL=NumberFieldIndex.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["CmsEntryOpenSearchFieldIndex","convertToString","value","Array","isArray","map","String","convertToFloat","parseFloat","v","NumberFieldIndexImpl","fieldType","unmappedType","toIndex","fromIndex","NumberFieldIndex","createImplementation","implementation","dependencies"],"sources":["NumberFieldIndex.ts"],"sourcesContent":["import { CmsEntryOpenSearchFieldIndex } from \"../abstractions/CmsEntryOpenSearchFieldIndex.js\";\n\nconst convertToString = (value: number[] | number) => {\n if (Array.isArray(value) === false) {\n return value;\n }\n return (value as number[]).map(String);\n};\n\nconst convertToFloat = (value: string[] | number) => {\n if (Array.isArray(value) === false) {\n return typeof value === \"string\" ? parseFloat(value) : value;\n }\n return (value as string[]).map(v => parseFloat(v));\n};\n\nclass NumberFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {\n public readonly fieldType = \"number\";\n\n public unmappedType(): string {\n return \"float\";\n }\n\n public toIndex({\n value\n }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue {\n return {\n value: convertToString(value)\n };\n }\n\n public fromIndex({ value }: CmsEntryOpenSearchFieldIndex.FromIndex): any {\n return convertToFloat(value);\n }\n}\n\nexport const NumberFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({\n implementation: NumberFieldIndexImpl,\n dependencies: []\n});\n"],"mappings":"AAAA,SAASA,4BAA4B;AAErC,MAAMC,eAAe,GAAIC,KAAwB,IAAK;EAClD,IAAIC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,KAAK,KAAK,EAAE;IAChC,OAAOA,KAAK;EAChB;EACA,OAAQA,KAAK,CAAcG,GAAG,CAACC,MAAM,CAAC;AAC1C,CAAC;AAED,MAAMC,cAAc,GAAIL,KAAwB,IAAK;EACjD,IAAIC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,KAAK,KAAK,EAAE;IAChC,OAAO,OAAOA,KAAK,KAAK,QAAQ,GAAGM,UAAU,CAACN,KAAK,CAAC,GAAGA,KAAK;EAChE;EACA,OAAQA,KAAK,CAAcG,GAAG,CAACI,CAAC,IAAID,UAAU,CAACC,CAAC,CAAC,CAAC;AACtD,CAAC;AAED,MAAMC,oBAAoB,CAAmD;EACzDC,SAAS,GAAG,QAAQ;EAE7BC,YAAYA,CAAA,EAAW;IAC1B,OAAO,OAAO;EAClB;EAEOC,OAAOA,CAAC;IACXX;EACkC,CAAC,EAAwC;IAC3E,OAAO;MACHA,KAAK,EAAED,eAAe,CAACC,KAAK;IAChC,CAAC;EACL;EAEOY,SAASA,CAAC;IAAEZ;EAA8C,CAAC,EAAO;IACrE,OAAOK,cAAc,CAACL,KAAK,CAAC;EAChC;AACJ;AAEA,OAAO,MAAMa,gBAAgB,GAAGf,4BAA4B,CAACgB,oBAAoB,CAAC;EAC9EC,cAAc,EAAEP,oBAAoB;EACpCQ,YAAY,EAAE;AAClB,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.js","sources":["../../../../src/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.ts"],"sourcesContent":["import { CmsEntryOpenSearchFieldIndex } from \"../abstractions/CmsEntryOpenSearchFieldIndex.js\";\n\nconst convertToString = (value: number[] | number) => {\n if (Array.isArray(value) === false) {\n return value;\n }\n return (value as number[]).map(String);\n};\n\nconst convertToFloat = (value: string[] | number) => {\n if (Array.isArray(value) === false) {\n return typeof value === \"string\" ? parseFloat(value) : value;\n }\n return (value as string[]).map(v => parseFloat(v));\n};\n\nclass NumberFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {\n public readonly fieldType = \"number\";\n\n public unmappedType(): string {\n return \"float\";\n }\n\n public toIndex({\n value\n }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue {\n return {\n value: convertToString(value)\n };\n }\n\n public fromIndex({ value }: CmsEntryOpenSearchFieldIndex.FromIndex): any {\n return convertToFloat(value);\n }\n}\n\nexport const NumberFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({\n implementation: NumberFieldIndexImpl,\n dependencies: []\n});\n"],"names":["convertToString","value","Array","String","convertToFloat","parseFloat","v","NumberFieldIndexImpl","NumberFieldIndex","CmsEntryOpenSearchFieldIndex"],"mappings":";AAEA,MAAMA,kBAAkB,CAACC;IACrB,IAAIC,AAAyB,UAAzBA,MAAM,OAAO,CAACD,QACd,OAAOA;IAEX,OAAQA,MAAmB,GAAG,CAACE;AACnC;AAEA,MAAMC,iBAAiB,CAACH;IACpB,IAAIC,AAAyB,UAAzBA,MAAM,OAAO,CAACD,QACd,OAAO,AAAiB,YAAjB,OAAOA,QAAqBI,WAAWJ,SAASA;IAE3D,OAAQA,MAAmB,GAAG,CAACK,CAAAA,IAAKD,WAAWC;AACnD;AAEA,MAAMC;IAGK,eAAuB;QAC1B,OAAO;IACX;IAEO,QAAQ,EACXN,KAAK,EAC8B,EAAwC;QAC3E,OAAO;YACH,OAAOD,gBAAgBC;QAC3B;IACJ;IAEO,UAAU,EAAEA,KAAK,EAA0C,EAAO;QACrE,OAAOG,eAAeH;IAC1B;;aAhBgB,SAAS,GAAG;;AAiBhC;AAEO,MAAMO,mBAAmBC,6BAA6B,oBAAoB,CAAC;IAC9E,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}