|
7 | 7 |
|
8 | 8 | /* eslint-disable @typescript-eslint/naming-convention */ |
9 | 9 |
|
10 | | -import { flow, mapValues } from 'lodash'; |
| 10 | +import { mapValues } from 'lodash'; |
11 | 11 | import { LensServerPluginSetup } from '../../../../lens/server'; |
12 | 12 |
|
13 | 13 | import { |
@@ -148,49 +148,43 @@ export const createCommentsMigrations = ( |
148 | 148 | ) as MigrateFunctionsObject; |
149 | 149 |
|
150 | 150 | const commentsMigrations = { |
151 | | - '7.11.0': flow( |
152 | | - ( |
153 | | - doc: SavedObjectUnsanitizedDoc<UnsanitizedComment> |
154 | | - ): SavedObjectSanitizedDoc<SanitizedComment> => { |
155 | | - return { |
156 | | - ...doc, |
157 | | - attributes: { |
158 | | - ...doc.attributes, |
159 | | - type: CommentType.user, |
160 | | - }, |
161 | | - references: doc.references || [], |
162 | | - }; |
163 | | - } |
164 | | - ), |
165 | | - '7.12.0': flow( |
166 | | - ( |
167 | | - doc: SavedObjectUnsanitizedDoc<UnsanitizedComment> |
168 | | - ): SavedObjectSanitizedDoc<SanitizedCommentForSubCases> => { |
169 | | - let attributes: SanitizedCommentForSubCases & UnsanitizedComment = { |
| 151 | + '7.11.0': ( |
| 152 | + doc: SavedObjectUnsanitizedDoc<UnsanitizedComment> |
| 153 | + ): SavedObjectSanitizedDoc<SanitizedComment> => { |
| 154 | + return { |
| 155 | + ...doc, |
| 156 | + attributes: { |
170 | 157 | ...doc.attributes, |
171 | | - associationType: AssociationType.case, |
172 | | - }; |
173 | | - |
174 | | - // only add the rule object for alert comments. Prior to 7.12 we only had CommentType.alert, generated alerts are |
175 | | - // introduced in 7.12. |
176 | | - if (doc.attributes.type === CommentType.alert) { |
177 | | - attributes = { ...attributes, rule: { id: null, name: null } }; |
178 | | - } |
179 | | - |
180 | | - return { |
181 | | - ...doc, |
182 | | - attributes, |
183 | | - references: doc.references || [], |
184 | | - }; |
185 | | - } |
186 | | - ), |
187 | | - '7.14.0': flow( |
188 | | - ( |
189 | | - doc: SavedObjectUnsanitizedDoc<Record<string, unknown>> |
190 | | - ): SavedObjectSanitizedDoc<SanitizedCaseOwner> => { |
191 | | - return addOwnerToSO(doc); |
| 158 | + type: CommentType.user, |
| 159 | + }, |
| 160 | + references: doc.references || [], |
| 161 | + }; |
| 162 | + }, |
| 163 | + '7.12.0': ( |
| 164 | + doc: SavedObjectUnsanitizedDoc<UnsanitizedComment> |
| 165 | + ): SavedObjectSanitizedDoc<SanitizedCommentForSubCases> => { |
| 166 | + let attributes: SanitizedCommentForSubCases & UnsanitizedComment = { |
| 167 | + ...doc.attributes, |
| 168 | + associationType: AssociationType.case, |
| 169 | + }; |
| 170 | + |
| 171 | + // only add the rule object for alert comments. Prior to 7.12 we only had CommentType.alert, generated alerts are |
| 172 | + // introduced in 7.12. |
| 173 | + if (doc.attributes.type === CommentType.alert) { |
| 174 | + attributes = { ...attributes, rule: { id: null, name: null } }; |
192 | 175 | } |
193 | | - ), |
| 176 | + |
| 177 | + return { |
| 178 | + ...doc, |
| 179 | + attributes, |
| 180 | + references: doc.references || [], |
| 181 | + }; |
| 182 | + }, |
| 183 | + '7.14.0': ( |
| 184 | + doc: SavedObjectUnsanitizedDoc<Record<string, unknown>> |
| 185 | + ): SavedObjectSanitizedDoc<SanitizedCaseOwner> => { |
| 186 | + return addOwnerToSO(doc); |
| 187 | + }, |
194 | 188 | }; |
195 | 189 |
|
196 | 190 | return mergeMigrationFunctionMaps(commentsMigrations, embeddableMigrations); |
|
0 commit comments