@@ -2,8 +2,9 @@ import { InfraClient, InstanceOptions, IOContext } from '@vtex/api'
2
2
import { IOClientFactory } from '../IOClientFactory'
3
3
4
4
const routes = {
5
- Bucket : ( bucket : string ) => `/buckets/${ bucket } ` ,
6
- File : ( bucket : string , path : string ) => `${ routes . Bucket ( bucket ) } /userData/files/${ path } ` ,
5
+ Bucket : ( bucket : string ) => `${ bucket } ` ,
6
+ File : ( bucket : string , path : string ) => `buckets/${ routes . Bucket ( bucket ) } /files/${ path } ` ,
7
+ Conflicts : ( bucket : string ) => `buckets/${ routes . Bucket ( bucket ) } /conflicts` ,
7
8
}
8
9
9
10
export class VBase extends InfraClient {
@@ -21,10 +22,30 @@ export class VBase extends InfraClient {
21
22
} )
22
23
}
23
24
25
+ public resolveConflict = ( bucketKey : string , path : string , content : any ) => {
26
+ const data = [
27
+ {
28
+ op : 'replace' ,
29
+ path,
30
+ value : content ,
31
+ } ,
32
+ ]
33
+
34
+ return this . http . patch ( routes . Conflicts ( `vtex.pages-graphql/${ bucketKey } ` ) , data , {
35
+ metric : 'vbase-resolve-conflicts' ,
36
+ } )
37
+ }
38
+
39
+ public getConflicts = async ( ) => {
40
+ return this . http . get ( routes . Conflicts ( 'vtex.pages-graphql/userData' ) , {
41
+ metric : 'vbase-get-conflicts' ,
42
+ } )
43
+ }
44
+
24
45
public checkForConflicts = async ( ) => {
25
46
let status : number
26
47
try {
27
- const response = await this . http . get ( routes . File ( 'vtex.pages-graphql' , 'store/content.json' ) , {
48
+ const response = await this . http . get ( routes . File ( 'vtex.pages-graphql/userData ' , 'store/content.json' ) , {
28
49
metric : 'vbase-conflict' ,
29
50
} )
30
51
status = response . status
0 commit comments