@@ -59,7 +59,7 @@ async function setupPaidFetch() {
5959}
6060
6161async function quote ( ) {
62- const res = await fetch ( `${ API } /v1/ projects` ) ;
62+ const res = await fetch ( `${ API } /projects/v1 ` ) ;
6363 const data = await res . json ( ) ;
6464 if ( ! res . ok ) { console . error ( JSON . stringify ( { status : "error" , http : res . status , ...data } ) ) ; process . exit ( 1 ) ; }
6565 console . log ( JSON . stringify ( data , null , 2 ) ) ;
@@ -74,7 +74,7 @@ async function provision(args) {
7474 const fetchPaid = await setupPaidFetch ( ) ;
7575 const body = { tier : opts . tier } ;
7676 if ( opts . name ) body . name = opts . name ;
77- const res = await fetchPaid ( `${ API } /v1/ projects` , {
77+ const res = await fetchPaid ( `${ API } /projects/v1 ` , {
7878 method : "POST" ,
7979 headers : { "Content-Type" : "application/json" } ,
8080 body : JSON . stringify ( body ) ,
@@ -98,7 +98,7 @@ async function provision(args) {
9898async function rls ( projectId , template , tablesJson ) {
9999 const p = findProject ( projectId ) ;
100100 const tables = JSON . parse ( tablesJson ) ;
101- const res = await fetch ( `${ API } /admin /v1/projects /${ projectId } /rls` , {
101+ const res = await fetch ( `${ API } /projects /v1/admin /${ projectId } /rls` , {
102102 method : "POST" ,
103103 headers : { "Authorization" : `Bearer ${ p . service_key } ` , "Content-Type" : "application/json" } ,
104104 body : JSON . stringify ( { template, tables } ) ,
@@ -116,7 +116,7 @@ async function list() {
116116
117117async function sqlCmd ( projectId , query ) {
118118 const p = findProject ( projectId ) ;
119- const res = await fetch ( `${ API } /admin /v1/projects /${ projectId } /sql` , { method : "POST" , headers : { "Authorization" : `Bearer ${ p . service_key } ` , "Content-Type" : "text/plain" } , body : query } ) ;
119+ const res = await fetch ( `${ API } /projects /v1/admin /${ projectId } /sql` , { method : "POST" , headers : { "Authorization" : `Bearer ${ p . service_key } ` , "Content-Type" : "text/plain" } , body : query } ) ;
120120 console . log ( JSON . stringify ( await res . json ( ) , null , 2 ) ) ;
121121}
122122
@@ -128,23 +128,23 @@ async function rest(projectId, table, queryParams) {
128128
129129async function usage ( projectId ) {
130130 const p = findProject ( projectId ) ;
131- const res = await fetch ( `${ API } /admin /v1/projects /${ projectId } /usage` , { headers : { "Authorization" : `Bearer ${ p . service_key } ` } } ) ;
131+ const res = await fetch ( `${ API } /projects /v1/admin /${ projectId } /usage` , { headers : { "Authorization" : `Bearer ${ p . service_key } ` } } ) ;
132132 const data = await res . json ( ) ;
133133 if ( ! res . ok ) { console . error ( JSON . stringify ( { status : "error" , http : res . status , ...data } ) ) ; process . exit ( 1 ) ; }
134134 console . log ( JSON . stringify ( data , null , 2 ) ) ;
135135}
136136
137137async function schema ( projectId ) {
138138 const p = findProject ( projectId ) ;
139- const res = await fetch ( `${ API } /admin /v1/projects /${ projectId } /schema` , { headers : { "Authorization" : `Bearer ${ p . service_key } ` } } ) ;
139+ const res = await fetch ( `${ API } /projects /v1/admin /${ projectId } /schema` , { headers : { "Authorization" : `Bearer ${ p . service_key } ` } } ) ;
140140 const data = await res . json ( ) ;
141141 if ( ! res . ok ) { console . error ( JSON . stringify ( { status : "error" , http : res . status , ...data } ) ) ; process . exit ( 1 ) ; }
142142 console . log ( JSON . stringify ( data , null , 2 ) ) ;
143143}
144144
145145async function renew ( projectId ) {
146146 const fetchPaid = await setupPaidFetch ( ) ;
147- const res = await fetchPaid ( `${ API } /v1/ projects/${ projectId } /renew` , { method : "POST" , headers : { "Content-Type" : "application/json" } } ) ;
147+ const res = await fetchPaid ( `${ API } /projects/v1 /${ projectId } /renew` , { method : "POST" , headers : { "Content-Type" : "application/json" } } ) ;
148148 const data = await res . json ( ) ;
149149 if ( ! res . ok ) { console . error ( JSON . stringify ( { status : "error" , http : res . status , ...data } ) ) ; process . exit ( 1 ) ; }
150150 const projects = loadProjects ( ) ;
@@ -155,7 +155,7 @@ async function renew(projectId) {
155155
156156async function deleteProject ( projectId ) {
157157 const p = findProject ( projectId ) ;
158- const res = await fetch ( `${ API } /v1/ projects/${ projectId } ` , { method : "DELETE" , headers : { "Authorization" : `Bearer ${ p . service_key } ` } } ) ;
158+ const res = await fetch ( `${ API } /projects/v1 /${ projectId } ` , { method : "DELETE" , headers : { "Authorization" : `Bearer ${ p . service_key } ` } } ) ;
159159 if ( res . status === 204 || res . ok ) {
160160 saveProjects ( loadProjects ( ) . filter ( pr => pr . project_id !== projectId ) ) ;
161161 console . log ( JSON . stringify ( { status : "ok" , message : `Project ${ projectId } deleted.` } ) ) ;
0 commit comments