@@ -14,26 +14,30 @@ interface CliContext {
1414}
1515
1616const commandHandlers : Record < string , CommandHandler > = {
17- ' health' : ( { client } ) => client . healthCheck ( ) ,
17+ health : ( { client } ) => client . healthCheck ( ) ,
1818 'submit-query' : ( { client, flags } ) => client . submitQuery ( readSubmitInput ( flags ) ) ,
1919 'submit-and-wait' : ( { client, flags } ) => submitAndWait ( client , readSubmitInput ( flags ) , readWaitOptions ( flags ) ) ,
2020 'retry-query' : ( { client, flags, positionals } ) => client . retryQuery ( requiredId ( flags , positionals , 'query-id' ) ) ,
21- 'retry-if-retriable' : ( { client, flags, positionals } ) => retryIfRetriable ( client , requiredId ( flags , positionals , 'query-id' ) ) ,
21+ 'retry-if-retriable' : ( { client, flags, positionals } ) =>
22+ retryIfRetriable ( client , requiredId ( flags , positionals , 'query-id' ) ) ,
2223 'get-query-details' : ( { client, flags, positionals } ) => client . getQuery ( requiredId ( flags , positionals , 'query-id' ) ) ,
2324 'get-query-by-dedup-id' : ( { client, flags, positionals } ) =>
2425 client . getQueryByDedupId ( requiredId ( flags , positionals , 'dedup-id' ) ) ,
2526 'get-my-queries' : ( { client, flags } ) => client . listQueries ( readPagination ( flags ) ) ,
2627 'get-query-jobs' : ( { client, flags, positionals } ) => client . getQueryJobs ( requiredId ( flags , positionals , 'query-id' ) ) ,
27- 'get-query-with-jobs' : ( { client, flags, positionals } ) => getQueryWithJobs ( client , requiredId ( flags , positionals , 'query-id' ) ) ,
28+ 'get-query-with-jobs' : ( { client, flags, positionals } ) =>
29+ getQueryWithJobs ( client , requiredId ( flags , positionals , 'query-id' ) ) ,
2830 'get-query-stats' : ( { client } ) => client . getQueryStats ( ) ,
2931 'list-buckets' : ( { client, flags } ) => client . listBuckets ( readPagination ( flags ) ) ,
3032 'create-bucket' : ( { client, flags } ) =>
31- client . createBucket ( compact ( {
32- aggregatorVersion : requiredString ( flags , 'aggregator-version' ) ,
33- externalId : optionalString ( flags , 'external-id' ) ?? null ,
34- nodeWidth : optionalNumber ( flags , 'node-width' ) ?? null ,
35- mockProof : optionalBoolean ( flags , 'mock-proof' ) ?? null ,
36- } ) ) ,
33+ client . createBucket (
34+ compact ( {
35+ aggregatorVersion : requiredString ( flags , 'aggregator-version' ) ,
36+ externalId : optionalString ( flags , 'external-id' ) ?? null ,
37+ nodeWidth : optionalNumber ( flags , 'node-width' ) ?? null ,
38+ mockProof : optionalBoolean ( flags , 'mock-proof' ) ?? null ,
39+ } ) ,
40+ ) ,
3741 'get-bucket' : ( { client, flags, positionals } ) => client . getBucket ( requiredId ( flags , positionals , 'bucket-id' ) ) ,
3842 'close-bucket' : ( { client, flags, positionals } ) => client . closeBucket ( requiredId ( flags , positionals , 'bucket-id' ) ) ,
3943 'submit-to-bucket' : ( { client, flags } ) =>
@@ -44,7 +48,9 @@ const commandHandlers: Record<string, CommandHandler> = {
4448 } ) ,
4549 'create-bucket-and-submit' : ( { client, flags } ) =>
4650 createBucketAndSubmit ( client , {
47- bucket : { aggregatorVersion : requiredString ( flags , 'aggregator-version' ) } ,
51+ bucket : {
52+ aggregatorVersion : requiredString ( flags , 'aggregator-version' ) ,
53+ } ,
4854 queries : [ readSubmitInput ( flags ) ] ,
4955 } ) ,
5056} ;
@@ -58,7 +64,11 @@ export async function runCli(argv: string[]): Promise<number> {
5864
5965 const handler = commandHandlers [ command ] ;
6066 if ( ! handler ) {
61- printJson ( { ok : false , error : { message : `Unknown command: ${ command } ` } , commands : Object . keys ( commandHandlers ) . sort ( ) } ) ;
67+ printJson ( {
68+ ok : false ,
69+ error : { message : `Unknown command: ${ command } ` } ,
70+ commands : Object . keys ( commandHandlers ) . sort ( ) ,
71+ } ) ;
6272 return 1 ;
6373 }
6474
@@ -76,7 +86,10 @@ export async function runCli(argv: string[]): Promise<number> {
7686 }
7787}
7888
79- export function parseArgs ( argv : string [ ] ) : { flags : Record < string , string | boolean > ; positionals : string [ ] } {
89+ export function parseArgs ( argv : string [ ] ) : {
90+ flags : Record < string , string | boolean > ;
91+ positionals : string [ ] ;
92+ } {
8093 const flags : Record < string , string | boolean > = { } ;
8194 const positionals : string [ ] = [ ] ;
8295
@@ -138,7 +151,11 @@ function readPagination(flags: Record<string, string | boolean | undefined>) {
138151 return pagination ;
139152}
140153
141- function requiredId ( flags : Record < string , string | boolean | undefined > , positionals : string [ ] , flagName : string ) : string {
154+ function requiredId (
155+ flags : Record < string , string | boolean | undefined > ,
156+ positionals : string [ ] ,
157+ flagName : string ,
158+ ) : string {
142159 return optionalString ( flags , flagName ) ?? positionals [ 0 ] ?? fail ( `Missing required ${ flagName } ` ) ;
143160}
144161
0 commit comments