|
1 | 1 | import { getEventSource, type SdkEvent } from '../../sdkEvent' |
2 | 2 | import { createLogger } from '../../../common/logger' |
3 | | -import { FACET_ROOT } from '../../facets.constants' |
4 | 3 | import type { FacetValue, FieldPath, FieldMultiValue, FieldValue } from '../../facets.constants' |
| 4 | +import { FACET_ROOT } from '../../facets.constants' |
5 | 5 |
|
6 | 6 | const logger = createLogger('facetRegistry') |
7 | 7 |
|
@@ -117,15 +117,16 @@ export function getAllFields(event: object) { |
117 | 117 | getAllFieldsRecursively(item, path) |
118 | 118 | } |
119 | 119 | } else if (typeof value === 'object' && value !== null) { |
| 120 | + const typedValue = value as Record<string, unknown> |
120 | 121 | if (path !== undefined) { |
121 | 122 | // Store the intermediary field |
122 | | - pushField(path, value) |
| 123 | + pushField(path, typedValue) |
123 | 124 | } |
124 | 125 | // Recurse inside objects, building the path on the way |
125 | | - for (const key in value) { |
126 | | - if (Object.prototype.hasOwnProperty.call(value, key)) { |
| 126 | + for (const key in typedValue) { |
| 127 | + if (Object.prototype.hasOwnProperty.call(typedValue, key)) { |
127 | 128 | const itemPath = path === undefined ? key : `${path}.${key}` |
128 | | - const itemValue = (value as { [key: string]: unknown })[key] |
| 129 | + const itemValue = (typedValue as { [key: string]: unknown })[key] |
129 | 130 | getAllFieldsRecursively(itemValue, itemPath) |
130 | 131 | } |
131 | 132 | } |
|
0 commit comments