@@ -127,6 +127,11 @@ async function handleResponse (response, params) {
127127 }
128128}
129129
130+ /** @private */
131+ function logDebug ( op , url , reqOptions ) {
132+ logger . debug ( `${ op } ${ JSON . stringify ( { url, ...utils . withHiddenFields ( reqOptions , [ 'headers.Authorization' ] ) } ) } ` )
133+ }
134+
130135/**
131136 * @abstract
132137 * @class AdobeState
@@ -185,7 +190,6 @@ class AdobeState {
185190 createRequestUrl ( containerURLPath = '' , queryObject = { } ) {
186191 const urlString = `${ this . endpoint } /containers/${ this . namespace } ${ containerURLPath } `
187192
188- logger . debug ( 'requestUrl string' , urlString )
189193 const requestUrl = new url . URL ( urlString )
190194 // add the query params
191195 requestUrl . search = ( new url . URLSearchParams ( queryObject ) ) . toString ( )
@@ -263,8 +267,6 @@ class AdobeState {
263267 * @memberof AdobeState
264268 */
265269 async get ( key ) {
266- logger . debug ( `get '${ key } '` )
267-
268270 const schema = {
269271 type : 'object' ,
270272 properties : {
@@ -289,8 +291,11 @@ class AdobeState {
289291 ...this . getAuthorizationHeaders ( )
290292 }
291293 }
292- logger . debug ( 'get' , requestOptions )
293- const promise = this . fetchRetry . exponentialBackoff ( this . createRequestUrl ( `/data/${ key } ` ) , requestOptions )
294+
295+ const url = this . createRequestUrl ( `/data/${ key } ` )
296+ logDebug ( 'get' , url , requestOptions )
297+
298+ const promise = this . fetchRetry . exponentialBackoff ( url , requestOptions )
294299 const response = await _wrap ( promise , { key } )
295300 if ( response . ok ) {
296301 // we only expect string values
@@ -356,10 +361,11 @@ class AdobeState {
356361 body : value
357362 }
358363
359- logger . debug ( 'put' , requestOptions )
364+ const url = this . createRequestUrl ( `/data/ ${ key } ` , queryParams )
360365
366+ logDebug ( 'put' , url , requestOptions )
361367 const promise = this . fetchRetry . exponentialBackoff (
362- this . createRequestUrl ( `/data/ ${ key } ` , queryParams ) ,
368+ url ,
363369 requestOptions
364370 )
365371 await _wrap ( promise , { key, value, ...options } , true )
@@ -400,9 +406,10 @@ class AdobeState {
400406 } ) )
401407 }
402408
403- logger . debug ( 'delete' , requestOptions )
409+ const url = this . createRequestUrl ( `/data/ ${ key } ` )
404410
405- const promise = this . fetchRetry . exponentialBackoff ( this . createRequestUrl ( `/data/${ key } ` ) , requestOptions )
411+ logDebug ( 'delete' , url , requestOptions )
412+ const promise = this . fetchRetry . exponentialBackoff ( url , requestOptions )
406413 const response = await _wrap ( promise , { key } )
407414 if ( response . status === 404 ) {
408415 return null
@@ -429,8 +436,6 @@ class AdobeState {
429436 }
430437 }
431438
432- logger . debug ( 'deleteAll' , requestOptions )
433-
434439 const schema = {
435440 type : 'object' ,
436441 properties : {
@@ -447,9 +452,12 @@ class AdobeState {
447452 }
448453
449454 const queryParams = { matchData : options . match }
455+ const url = this . createRequestUrl ( '' , queryParams )
456+
457+ logDebug ( 'deleteAll' , url , requestOptions )
450458
451459 // ! be extra cautious, if the `matchData` param is not specified the whole container will be deleted
452- const promise = this . fetchRetry . exponentialBackoff ( this . createRequestUrl ( '' , queryParams ) , requestOptions )
460+ const promise = this . fetchRetry . exponentialBackoff ( url , requestOptions )
453461 const response = await _wrap ( promise , { } )
454462
455463 if ( response . status === 404 ) {
@@ -474,9 +482,10 @@ class AdobeState {
474482 }
475483 }
476484
477- logger . debug ( 'any' , requestOptions )
485+ const url = this . createRequestUrl ( )
486+ logDebug ( 'any' , url , requestOptions )
478487
479- const promise = this . fetchRetry . exponentialBackoff ( this . createRequestUrl ( ) , requestOptions )
488+ const promise = this . fetchRetry . exponentialBackoff ( url , requestOptions )
480489 const response = await _wrap ( promise , { } )
481490 return ( response . status !== 404 )
482491 }
@@ -495,9 +504,10 @@ class AdobeState {
495504 }
496505 }
497506
498- logger . debug ( 'stats' , requestOptions )
507+ const url = this . createRequestUrl ( )
508+ logDebug ( 'stats' , url , requestOptions )
499509
500- const promise = this . fetchRetry . exponentialBackoff ( this . createRequestUrl ( ) , requestOptions )
510+ const promise = this . fetchRetry . exponentialBackoff ( url , requestOptions )
501511 const response = await _wrap ( promise , { } )
502512 if ( response . status === 404 ) {
503513 return { keys : 0 , bytesKeys : 0 , bytesValues : 0 }
@@ -531,7 +541,6 @@ class AdobeState {
531541 ...this . getAuthorizationHeaders ( )
532542 }
533543 }
534- logger . debug ( 'list' , requestOptions )
535544
536545 const queryParams = { }
537546 if ( options . match ) {
@@ -568,8 +577,11 @@ class AdobeState {
568577 let cursor = 0
569578
570579 do {
580+ const url = stateInstance . createRequestUrl ( '/data' , { ...queryParams , cursor } )
581+ logDebug ( 'list' , url , requestOptions )
582+
571583 const promise = stateInstance . fetchRetry . exponentialBackoff (
572- stateInstance . createRequestUrl ( '/data' , { ... queryParams , cursor } ) ,
584+ url ,
573585 requestOptions
574586 )
575587 const response = await _wrap ( promise , { ...queryParams , cursor } )
0 commit comments