export const HANDLED_ROOT_KEYS = new Set([
  'name',
  'type',
  'begin',
  'end',
  'timestamp',
  'duration',
  'usageMetadata',
  'inputs',
  'outputs',
  'attributes',
  'children',
  'id',
  'traceName',
  'date',
])

export function getUnknownRootFields(
  node: Record<string, unknown>,
  handledKeys: Set<string> = HANDLED_ROOT_KEYS,
): Record<string, unknown> {
  return Object.fromEntries(
    Object.entries(node).filter(([key, value]) => !handledKeys.has(key) && value !== undefined),
  )
}
