@@ -43,6 +43,14 @@ export const data = new Command("data")
43
43
. choices ( [ "asc" , "desc" ] )
44
44
. default ( "desc" ) ,
45
45
)
46
+ . addOption (
47
+ new Option (
48
+ "--component-path <path>" ,
49
+ "Path to the component in the component tree defined in convex.config.ts.\n" +
50
+ " By default, inspects data in the root component" ,
51
+ // TODO(ENG-6967): Remove hideHelp before launching components
52
+ ) . hideHelp ( ) ,
53
+ )
46
54
. addDeploymentSelectionOptions ( actionDescription ( "Inspect the database in" ) )
47
55
. showHelpAfterError ( )
48
56
. action ( async ( tableName , options ) => {
@@ -59,9 +67,16 @@ export const data = new Command("data")
59
67
await listDocuments ( ctx , deploymentUrl , adminKey , tableName , {
60
68
...options ,
61
69
order : options . order as "asc" | "desc" ,
70
+ componentPath : options . componentPath ?? "" ,
62
71
} ) ;
63
72
} else {
64
- await listTables ( ctx , deploymentUrl , adminKey , deploymentName ) ;
73
+ await listTables (
74
+ ctx ,
75
+ deploymentUrl ,
76
+ adminKey ,
77
+ deploymentName ,
78
+ options . componentPath ?? "" ,
79
+ ) ;
65
80
}
66
81
} ) ;
67
82
@@ -70,12 +85,14 @@ async function listTables(
70
85
deploymentUrl : string ,
71
86
adminKey : string ,
72
87
deploymentName : string | undefined ,
88
+ componentPath : string ,
73
89
) {
74
90
const tables = ( await runPaginatedQuery (
75
91
ctx ,
76
92
deploymentUrl ,
77
93
adminKey ,
78
94
"_system/cli/tables" ,
95
+ componentPath ,
79
96
{ } ,
80
97
) ) as { name : string } [ ] ;
81
98
if ( tables . length === 0 ) {
@@ -100,13 +117,15 @@ async function listDocuments(
100
117
options : {
101
118
limit : number ;
102
119
order : "asc" | "desc" ;
120
+ componentPath : string ;
103
121
} ,
104
122
) {
105
123
const data = ( await runPaginatedQuery (
106
124
ctx ,
107
125
deploymentUrl ,
108
126
adminKey ,
109
127
"_system/cli/tableData" ,
128
+ options . componentPath ,
110
129
{
111
130
table : tableName ,
112
131
order : options . order ?? "desc" ,
0 commit comments