From 359fd8511a3c396312f76b64e2572868893a1518 Mon Sep 17 00:00:00 2001 From: Ben Sabic Date: Fri, 20 Feb 2026 13:16:13 +1100 Subject: [PATCH] fix: flatten nested objects in printTable output Map raw API responses to scalar fields before passing to printTable in tables list, plans order, records find, and members find. Reuses existing flattenMember helper and the records export flattening pattern. --- src/commands/members.ts | 2 +- src/commands/plans.ts | 10 +++++++++- src/commands/records.ts | 9 ++++++++- src/commands/tables.ts | 12 +++++++++++- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/commands/members.ts b/src/commands/members.ts index c94968f..83c5da5 100644 --- a/src/commands/members.ts +++ b/src/commands/members.ts @@ -654,7 +654,7 @@ membersCommand spinner.stop(); printSuccess(`Found ${members.length} member(s)`); - printTable(members); + printTable(members.map(flattenMember)); } catch (error) { spinner.stop(); printError( diff --git a/src/commands/plans.ts b/src/commands/plans.ts index 246635c..361050a 100644 --- a/src/commands/plans.ts +++ b/src/commands/plans.ts @@ -441,7 +441,15 @@ plansCommand }); spinner.stop(); printSuccess("Plans reordered successfully."); - printTable(result.orderPlans); + const rows = (result.orderPlans ?? []).map((plan) => ({ + id: plan.id, + name: plan.name, + status: plan.status, + isPaid: plan.isPaid, + memberCount: plan.memberCount, + priority: plan.priority, + })); + printTable(rows); } catch (error) { spinner.stop(); printError( diff --git a/src/commands/records.ts b/src/commands/records.ts index bd373ec..c4360db 100644 --- a/src/commands/records.ts +++ b/src/commands/records.ts @@ -268,7 +268,14 @@ recordsCommand variables, }); spinner.stop(); - const records = result.dataRecords.edges.map((e) => e.node); + const records = result.dataRecords.edges.map((e) => ({ + id: e.node.id, + createdAt: e.node.createdAt, + updatedAt: e.node.updatedAt, + ...Object.fromEntries( + Object.entries(e.node.data).map(([k, v]) => [`data.${k}`, v]) + ), + })); printSuccess(`Found ${records.length} record(s)`); printTable(records); } catch (error) { diff --git a/src/commands/tables.ts b/src/commands/tables.ts index dfa8918..7a6f92b 100644 --- a/src/commands/tables.ts +++ b/src/commands/tables.ts @@ -75,7 +75,17 @@ tablesCommand query: `query { dataTables { ${TABLE_FIELDS} } }`, }); spinner.stop(); - printTable(result.dataTables); + const rows = result.dataTables.map((t) => ({ + id: t.id, + key: t.key, + name: t.name, + createdAt: t.createdAt, + createRule: t.createRule, + readRule: t.readRule, + updateRule: t.updateRule, + deleteRule: t.deleteRule, + })); + printTable(rows); } catch (error) { spinner.stop(); printError(