@@ -94,10 +94,20 @@ function ImportSupervisor(services, config) {
9494 * @param {string } hashedApiKey - API key used to authenticate the import job request.
9595 * @param {object } options - Client provided options for the import job.
9696 * @param initiatedBy - Details about the initiator of the import job.
97+ * @param {boolean } hasCustomHeaders - Whether custom headers are provided. Defaults to false.
98+ * @param {boolean } hasCustomImportJs - Whether custom import JS is provided. Defaults to false.
9799 * @returns {Promise<ImportJob> }
98100 */
99- async function createNewImportJob ( urls , importQueueId , hashedApiKey , options , initiatedBy ) {
100- const newJob = {
101+ async function createNewImportJob (
102+ urls ,
103+ importQueueId ,
104+ hashedApiKey ,
105+ options ,
106+ initiatedBy ,
107+ hasCustomHeaders = false ,
108+ hasCustomImportJs = false ,
109+ ) {
110+ return dataAccess . createNewImportJob ( {
101111 id : crypto . randomUUID ( ) ,
102112 baseURL : determineBaseURL ( urls ) ,
103113 importQueueId,
@@ -106,8 +116,9 @@ function ImportSupervisor(services, config) {
106116 urlCount : urls . length ,
107117 status : ImportJobStatus . RUNNING ,
108118 initiatedBy,
109- } ;
110- return dataAccess . createNewImportJob ( newJob ) ;
119+ hasCustomHeaders,
120+ hasCustomImportJs,
121+ } ) ;
111122 }
112123
113124 /**
@@ -126,6 +137,7 @@ function ImportSupervisor(services, config) {
126137 * asynchronously.
127138 * @param {Array<string> } urls - Array of URL records to queue.
128139 * @param {object } importJob - The import job record.
140+ * @param {object } customHeaders - Optional custom headers to be sent with each request.
129141 */
130142 async function queueUrlsForImportWorker ( urls , importJob , customHeaders ) {
131143 log . info ( `Starting a new import job of baseUrl: ${ importJob . getBaseURL ( ) } with ${ urls . length } `
@@ -159,8 +171,8 @@ function ImportSupervisor(services, config) {
159171 * @param {string } importApiKey - The API key to use for the import job.
160172 * @param {object } options - Optional configuration params for the import job.
161173 * @param {string } importScript - Optional custom Base64 encoded import script.
162- * @param initiatedBy - Details about the initiator of the import job.
163- * @param customHeaders - Optional custom headers to be sent with each request.
174+ * @param { object } initiatedBy - Details about the initiator of the import job.
175+ * @param { object } customHeaders - Optional custom headers to be sent with each request.
164176 * @returns {Promise<ImportJob> }
165177 */
166178 async function startNewJob (
@@ -184,6 +196,8 @@ function ImportSupervisor(services, config) {
184196 hashedApiKey ,
185197 options ,
186198 initiatedBy ,
199+ ! ! customHeaders ,
200+ ! ! importScript ,
187201 ) ;
188202
189203 log . info ( 'New import job created:\n'
0 commit comments