File tree Expand file tree Collapse file tree 1 file changed +29
-23
lines changed
Expand file tree Collapse file tree 1 file changed +29
-23
lines changed Original file line number Diff line number Diff line change @@ -877,31 +877,37 @@ export class JupiterOneClient {
877877 } ) : Promise < SyncJobResponse > {
878878 const { syncJobId, entities, relationships } = options ;
879879 const headers = this . headers ;
880- const entitiesResponse = await makeFetchRequest (
881- this . apiUrl + `/persister/synchronization/jobs/${ syncJobId } /entities` ,
882- {
883- method : 'POST' ,
884- headers,
885- body : JSON . stringify ( {
886- entities,
887- } ) ,
888- } ,
889- ) ;
890- validateSyncJobResponse ( entitiesResponse ) ;
880+ let response : SyncJobResponse | undefined = undefined ;
881+ if ( entities . length ) {
882+ const entitiesResponse = await makeFetchRequest (
883+ this . apiUrl + `/persister/synchronization/jobs/${ syncJobId } /entities` ,
884+ {
885+ method : 'POST' ,
886+ headers,
887+ body : JSON . stringify ( {
888+ entities,
889+ } ) ,
890+ } ,
891+ ) ;
892+ response = await validateSyncJobResponse ( entitiesResponse ) ;
893+ }
891894
892- const relationshipsResponse = await makeFetchRequest (
893- this . apiUrl +
894- `/persister/synchronization/jobs/${ syncJobId } /relationships` ,
895- {
896- method : 'POST' ,
897- headers,
898- body : JSON . stringify ( {
899- relationships,
900- } ) ,
901- } ,
902- ) ;
895+ if ( relationships . length ) {
896+ const relationshipsResponse = await makeFetchRequest (
897+ this . apiUrl +
898+ `/persister/synchronization/jobs/${ syncJobId } /relationships` ,
899+ {
900+ method : 'POST' ,
901+ headers,
902+ body : JSON . stringify ( {
903+ relationships,
904+ } ) ,
905+ } ,
906+ ) ;
903907
904- return validateSyncJobResponse ( relationshipsResponse ) ;
908+ response = await validateSyncJobResponse ( relationshipsResponse ) ;
909+ }
910+ return response ;
905911 }
906912
907913 async finalizeSyncJob ( options : {
You can’t perform that action at this time.
0 commit comments