chore(cli): rename test files from .mts to .ts

This commit is contained in:
Mohamed Boudra
2026-01-28 23:34:22 +07:00
parent d51d70a6fd
commit d78c7d5e07
17 changed files with 264 additions and 94 deletions
+10
View File
@@ -16,7 +16,17 @@ export function renderJson<T>(
// Apply custom serializer if provided
if (schema.serialize) {
if (result.type === 'list') {
// If all items serialize to the same object, return just one
// This handles the case where a list of key-value rows should serialize
// to a single structured object
const serialized = result.data.map((item) => schema.serialize!(item))
if (serialized.length > 0) {
const first = JSON.stringify(serialized[0])
const allSame = serialized.every((s) => JSON.stringify(s) === first)
if (allSame) {
return JSON.stringify(serialized[0], null, 2)
}
}
return JSON.stringify(serialized, null, 2)
} else {
const serialized = schema.serialize(result.data)