@@ -35,15 +35,16 @@ export type DataSeedingOperation = 'data-generation' | 'data-copy';
3535const baseUrl = 'https://api.salesforce.com/platform/data-seed/v1' ;
3636const seedUrl = `${ baseUrl } /data-seed` ;
3737const pollUrl = `${ baseUrl } /status` ;
38-
38+ const sfRegion = 'us-east-1'
3939export const initiateDataSeed = async (
4040 config : string ,
4141 operation : DataSeedingOperation ,
4242 jwt : string ,
4343 srcOrgUrl : string ,
4444 srcAccessToken : string ,
4545 tgtOrgUrl : string ,
46- tgtAccessToken : string
46+ tgtAccessToken : string ,
47+ srcOrgId : string
4748) : Promise < SeedResponse > => {
4849 const form = new FormData ( ) ;
4950 form . append ( 'config_file' , fs . createReadStream ( config ) ) ;
@@ -52,13 +53,15 @@ export const initiateDataSeed = async (
5253 form . append ( 'source_instance_url' , srcOrgUrl ) ;
5354 form . append ( 'target_access_token' , tgtAccessToken ) ;
5455 form . append ( 'target_instance_url' , tgtOrgUrl ) ;
56+ form . append ( 'source_org_id' , srcOrgId ) ;
5557 // TODO: Update to use .json() instead of JSON.parse once the Error response is changed to be JSON
5658 // Update the return type as well
5759 const response = await got . post ( seedUrl , {
5860 throwHttpErrors : false ,
5961 headers : {
6062 ...form . getHeaders ( ) ,
6163 Authorization : `Bearer ${ jwt } ` ,
64+ 'x-salesforce-region' :sfRegion ,
6265 } ,
6366 body : form ,
6467 } ) ;
@@ -110,12 +113,16 @@ const callAuthServlet = async (url: string, accessToken: string): Promise<AuthSe
110113 } ;
111114} ;
112115
113- export const pollSeedStatus = async ( jobId : string ) : Promise < PollSeedResponse > => {
116+ export const pollSeedStatus = async ( jobId : string , jwt : string ) : Promise < PollSeedResponse > => {
114117 const logger = await Logger . child ( 'PollSeedStatus' ) ;
115118
116119 // TODO: Update to use .json() instead of JSON.parse once the Error response is changed to be JSON
117120 // Update the return type as well
118- const response = await got . get ( `${ pollUrl } /${ jobId } ` , { throwHttpErrors : false } ) ;
121+ const headers = {
122+ Authorization : `Bearer ${ jwt } ` ,
123+ 'x-salesforce-region' : sfRegion ,
124+ } ;
125+ const response = await got . get ( `${ pollUrl } /${ jobId } ` , { throwHttpErrors : false , headers } ) ;
119126
120127 if ( response . statusCode !== 200 ) {
121128 // TODO: Print error body once the Error response is changed to be JSON
0 commit comments